How to get the month names in kendo chart by using function -
how create function month jan,feb.. displayed in kendo chart x axis.
var internetusers = [ { "month": "1", "year": "2010", "value": 1 }, { "month": "2", "year": "2010", "value": 2 }, { "month": "3", "year": "2010", "value": 3 }, { "month": "4", "year": "2010", "value": 4 }, { "month": "5", "year": "2010", "value": 5 }, { "month": "6", "year": "2010", "value": 6 }, { "month": "7", "year": "2010", "value": 7 }, { "month": "8", "year": "2010", "value": 8 }]; function createchart() { $("#chart").kendochart({ theme: $(document).data("kendoskin") || "default", datasource: { data: internetusers, group: { field: "year" }, sort: { field: "year", dir: "asc" } }, title: { text: "sales" }, legend: { position: "bottom" }, seriesdefaults: { type: "column" }, series: [{ field: "value" }], valueaxis: { labels: { format: "{0}$" }, line: { visible: false }, axiscrossingvalue: 0 }, categoryaxis: { field: "month" }, tooltip: { visible: true, format: "{0}%", template: "#= series.name #: #= value #" } }); } $(document).ready(function() { settimeout(function() { // initialize chart delay make sure // initial animation visible createchart(); $("#example").bind("kendo:skinchange", function(e) { createchart(); }); }, 400); }); </script>
you use kendoui's time format function:
kendo.tostring(new date(2000, value, 1), "mmmm"); // if value = 9, output september
check out kendoui's date format page. helpful. http://docs.telerik.com/kendo-ui/getting-started/framework/globalization/dateformatting
Comments
Post a Comment