1
<div id="example" class="k-content">
<div class="chart-wrapper">
<div id="chart"></div>
</div>
<script>
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
},
{
"Month": "9",
"year": "2010",
"value": 9
}, {
"Month": "10",
"year": "2010",
"value": 10
}, {
"Month": "11",
"year": "2010",
"value": 11
},
{
"Month": "12",
"year": "2010",
"value": 17117.00
},
{
"Month": "1",
"year": "2011",
"value": 12
}, {
"Month": "2",
"year": "2011",
"value": 13
}, {
"Month": "3",
"year": "2011",
"value": 4
}, {
"Month": "4",
"year": "2011",
"value": 6
}, {
"Month": "5",
"year": "2011",
"value": 24
},
{
"Month": "6",
"year": "2011",
"value": 3
}, {
"Month": "7",
"year": "2011",
"value": 35
}, {
"Month": "8",
"year": "2011",
"value": 34
},
{
"Month": "9",
"year": "2011",
"value": 22
}, {
"Month": "10",
"year": "2011",
"value": 21
}, {
"Month": "11",
"year": "2011",
"value": 215
},
{
"Month": "12",
"year": "2011",
"value": 12
}];
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 the chart with a delay to make sure
// the initial animation is visible
createChart();
$("#example").bind("kendo:skinChange", function(e) {
createChart();
});
}, 400);
});
</script>
</div>
http://jsbin.com/oxakup/17/edit
,617,451하지 표시하기 이유
Hai 대신 1,2,3 Jan으로 표시해야합니다. 2 월은 내가해야 할 일을 의미합니다. 레이블 형식 레이블 { 형식 : "MMMM" }을 사용했지만 표시하지 않았습니다. – kvs
글쎄, 당신의 숫자가 한 달을 대표한다는 것을 자동으로 알 수있는 방법은 없습니다. 숫자를 문자열에 수동으로 매핑하거나 수동으로 날짜 개체에 매핑 한 다음 문자열 형식 옵션을 사용하여 원하는 값을 출력해야합니다. – boniestlawyer
좋아,하지만 이제는 년과 월이있는 원격 데이터로 작업하고 있습니다.하지만 이제는 3 자로 된 월을 반환하는 함수를 만들어야합니다. – kvs