1

我一直在查看 Kendo 网站上的股票历史演示,并从中进行了一些工作。我正在生成一些数据并将其添加到剑道图表中,但由于某种原因,图表中缺少八月至十二月的数据。

源代码包含在下面,因此您可以复制 - 如果有人能告诉我为什么没有显示完整的数据,那就太好了。

<div class="k-widget k-chart" id="yearly-entity-prices-me"></div>
<script>
jQuery(function () {
    jQuery("#yearly-entity-prices-me").kendoChart({
        "series": [{
            "name": "Close",
            "groupNameTemplate": "#= group.value # (#= series.name #)",
            "type": "area",
            "field": "Close"
        }],
        "seriesDefaults": {
            "area": {
                "opacity": 0.8,
                "markers": {
                    "visible": false
                }
            }
        },
        "categoryAxis": {
            "labels": {
                "color": "#727f8e",
                "format": "MMM"
            },
            "majorGridLines": {
                "visible": false
            },
            "line": {
                "visible": false
            },
            "majorTicks": {
                "visible": false
            },
            "type": "Date",
            "categories": ["2011/01/31 00:00:00", "2011/02/28 00:00:00", "2011/03/31 00:00:00", "2011/04/29 00:00:00", "2011/05/31 00:00:00", "2011/06/30 00:00:00", "2011/07/29 00:00:00", "2011/08/31 00:00:00", "2011/09/30 00:00:00", "2011/10/31 00:00:00", "2011/11/30 00:00:00", "2011/12/30 00:00:00", "2011/01/31 00:00:00", "2011/02/28 00:00:00", "2011/03/31 00:00:00", "2011/04/29 00:00:00", "2011/05/31 00:00:00", "2011/06/30 00:00:00", "2011/07/29 00:00:00", "2011/08/31 00:00:00", "2011/09/30 00:00:00", "2011/10/31 00:00:00", "2011/11/30 00:00:00", "2011/12/30 00:00:00", "2011/01/31 00:00:00", "2011/02/28 00:00:00", "2011/03/31 00:00:00", "2011/04/29 00:00:00", "2011/05/31 00:00:00", "2011/06/30 00:00:00", "2011/07/29 00:00:00", "2011/08/31 00:00:00", "2011/09/30 00:00:00", "2011/10/31 00:00:00", "2011/11/30 00:00:00", "2011/12/30 00:00:00"]
        },
        "valueAxis": [{
            "labels": {
                "color": "#727f8e",
                "format": "${0}",
                "step": 2,
                "skip": 2
            },
            "line": {
                "visible": false
            }
        }],
        "dataSource": {
            "sort": [{
                "field": "Date",
                "dir": "asc"
            }],
            "group": [{
                "field": "Symbol",
                "dir": "asc"
            }],
            "schema": {
                "model": {
                    "fields": {
                        "DisplayDate": {
                            "editable": false,
                            "type": "string"
                        },
                        "Date": {
                            "type": "date"
                        },
                        "Close": {
                            "type": "number"
                        },
                        "Volume": {
                            "type": "number"
                        },
                        "Open": {
                            "type": "number"
                        },
                        "High": {
                            "type": "number"
                        },
                        "Low": {
                            "type": "number"
                        },
                        "Symbol": {
                            "type": "string"
                        }
                    }
                }
            },
            "data": [{
                "DisplayDate": "31/01/2011",
                "Date": "\/Date(1296432000000)\/",
                "Close": 600.36,
                "Volume": 2804332,
                "Open": 603.6,
                "High": 604.47,
                "Low": 595.55,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "28/02/2011",
                "Date": "\/Date(1298851200000)\/",
                "Close": 613.4,
                "Volume": 2281411,
                "Open": 610,
                "High": 616.49,
                "Low": 608.01,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "31/03/2011",
                "Date": "\/Date(1301526000000)\/",
                "Close": 586.76,
                "Volume": 2028228,
                "Open": 583,
                "High": 588.1612,
                "Low": 581.74,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "29/04/2011",
                "Date": "\/Date(1304031600000)\/",
                "Close": 544.1,
                "Volume": 3522997,
                "Open": 540,
                "High": 544.1,
                "Low": 538.51,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "31/05/2011",
                "Date": "\/Date(1306796400000)\/",
                "Close": 529.02,
                "Volume": 2685830,
                "Open": 525,
                "High": 529.05,
                "Low": 523.5,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "30/06/2011",
                "Date": "\/Date(1309388400000)\/",
                "Close": 506.38,
                "Volume": 2427330,
                "Open": 501.99,
                "High": 506.67,
                "Low": 501.5,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "29/07/2011",
                "Date": "\/Date(1311894000000)\/",
                "Close": 603.69,
                "Volume": 4133695,
                "Open": 604.23,
                "High": 614.96,
                "Low": 603.69,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "31/08/2011",
                "Date": "\/Date(1314745200000)\/",
                "Close": 540.96,
                "Volume": 2689989,
                "Open": 544.74,
                "High": 546.3,
                "Low": 536,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "30/09/2011",
                "Date": "\/Date(1317337200000)\/",
                "Close": 515.04,
                "Volume": 2723353,
                "Open": 520.21,
                "High": 524,
                "Low": 514.38,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "31/10/2011",
                "Date": "\/Date(1320019200000)\/",
                "Close": 592.64,
                "Volume": 2557538,
                "Open": 595.09,
                "High": 599.69,
                "Low": 591.67,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "30/11/2011",
                "Date": "\/Date(1322611200000)\/",
                "Close": 599.39,
                "Volume": 3390173,
                "Open": 597.95,
                "High": 599.51,
                "Low": 592.09,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "30/12/2011",
                "Date": "\/Date(1325203200000)\/",
                "Close": 645.9,
                "Volume": 1780941,
                "Open": 642.02,
                "High": 646.76,
                "Low": 642.02,
                "Symbol": "1. A001"
            }, {
                "DisplayDate": "31/01/2011",
                "Date": "\/Date(1296432000000)\/",
                "Close": 339.32,
                "Volume": 13457510,
                "Open": 335.8,
                "High": 340.04,
                "Low": 334.3,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "28/02/2011",
                "Date": "\/Date(1298851200000)\/",
                "Close": 353.21,
                "Volume": 14356740,
                "Open": 351.24,
                "High": 355.05,
                "Low": 351.12,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "31/03/2011",
                "Date": "\/Date(1301526000000)\/",
                "Close": 348.5075,
                "Volume": 9779020,
                "Open": 346.36,
                "High": 349.8,
                "Low": 346.06,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "29/04/2011",
                "Date": "\/Date(1304031600000)\/",
                "Close": 350.13,
                "Volume": 29776300,
                "Open": 346.78,
                "High": 353.95,
                "Low": 346.666,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "31/05/2011",
                "Date": "\/Date(1306796400000)\/",
                "Close": 347.83,
                "Volume": 14869200,
                "Open": 341.1,
                "High": 347.83,
                "Low": 341,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "30/06/2011",
                "Date": "\/Date(1309388400000)\/",
                "Close": 335.67,
                "Volume": 11526680,
                "Open": 334.7,
                "High": 336.13,
                "Low": 332.84,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "29/07/2011",
                "Date": "\/Date(1311894000000)\/",
                "Close": 390.48,
                "Volume": 22550900,
                "Open": 387.64,
                "High": 395.15,
                "Low": 384,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "31/08/2011",
                "Date": "\/Date(1314745200000)\/",
                "Close": 384.83,
                "Volume": 18643770,
                "Open": 390.57,
                "High": 392.08,
                "Low": 381.86,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "30/09/2011",
                "Date": "\/Date(1317337200000)\/",
                "Close": 381.32,
                "Volume": 19553550,
                "Open": 387.12,
                "High": 388.89,
                "Low": 381.18,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "31/10/2011",
                "Date": "\/Date(1320019200000)\/",
                "Close": 404.78,
                "Volume": 13762250,
                "Open": 402.42,
                "High": 409.33,
                "Low": 401.05,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "30/11/2011",
                "Date": "\/Date(1322611200000)\/",
                "Close": 382.2,
                "Volume": 14464710,
                "Open": 381.29,
                "High": 382.276,
                "Low": 378.3,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "30/12/2011",
                "Date": "\/Date(1325203200000)\/",
                "Close": 405,
                "Volume": 6414369,
                "Open": 403.51,
                "High": 406.28,
                "Low": 403.49,
                "Symbol": "2. A002"
            }, {
                "DisplayDate": "31/01/2011",
                "Date": "\/Date(1296432000000)\/",
                "Close": 169.64,
                "Volume": 6716002,
                "Open": 170.16,
                "High": 171.44,
                "Low": 167.41,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "28/02/2011",
                "Date": "\/Date(1298851200000)\/",
                "Close": 173.29,
                "Volume": 6781774,
                "Open": 173.91,
                "High": 175.89,
                "Low": 172.15,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "31/03/2011",
                "Date": "\/Date(1301526000000)\/",
                "Close": 180.13,
                "Volume": 4824628,
                "Open": 179.31,
                "High": 181.57,
                "Low": 178.5,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "29/04/2011",
                "Date": "\/Date(1304031600000)\/",
                "Close": 195.81,
                "Volume": 5697726,
                "Open": 194.38,
                "High": 196.59,
                "Low": 193.78,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "31/05/2011",
                "Date": "\/Date(1306796400000)\/",
                "Close": 196.69,
                "Volume": 3405698,
                "Open": 195.94,
                "High": 198.44,
                "Low": 195.03,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "30/06/2011",
                "Date": "\/Date(1309388400000)\/",
                "Close": 204.49,
                "Volume": 4446007,
                "Open": 200.78,
                "High": 205.2,
                "Low": 200.5,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "29/07/2011",
                "Date": "\/Date(1311894000000)\/",
                "Close": 222.52,
                "Volume": 5166268,
                "Open": 221.29,
                "High": 225.75,
                "Low": 219.51,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "31/08/2011",
                "Date": "\/Date(1314745200000)\/",
                "Close": 215.23,
                "Volume": 7397287,
                "Open": 212.27,
                "High": 216.17,
                "Low": 211.35,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "30/09/2011",
                "Date": "\/Date(1317337200000)\/",
                "Close": 216.23,
                "Volume": 6549641,
                "Open": 218.19,
                "High": 223,
                "Low": 215.21,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "31/10/2011",
                "Date": "\/Date(1320019200000)\/",
                "Close": 213.51,
                "Volume": 7336799,
                "Open": 215.79,
                "High": 218.89,
                "Low": 213.04,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "30/11/2011",
                "Date": "\/Date(1322611200000)\/",
                "Close": 192.29,
                "Volume": 7700490,
                "Open": 194.76,
                "High": 195.3,
                "Low": 188.75,
                "Symbol": "3. A003"
            }, {
                "DisplayDate": "30/12/2011",
                "Date": "\/Date(1325203200000)\/",
                "Close": 173.1,
                "Volume": 4279069,
                "Open": 173.36,
                "High": 175.17,
                "Low": 172.49,
                "Symbol": "3. A003"
            }]
        },
        "seriesColors": ["#F59549", "#F36C00", "#733300"],
        "autoBind": true
    });
});
</script>
4

1 回答 1

1

这是因为categories您重复了一些日期。尝试categories如下:

"categories"    : [
    "2011/01/31 00:00:00",
    "2011/02/28 00:00:00",
    "2011/03/31 00:00:00",
    "2011/04/29 00:00:00",
    "2011/05/31 00:00:00",
    "2011/06/30 00:00:00",
    "2011/07/29 00:00:00",
    "2011/08/31 00:00:00",
    "2011/09/30 00:00:00",
    "2011/10/31 00:00:00",
    "2011/11/30 00:00:00",
    "2011/12/30 00:00:00",
]
于 2013-01-11T22:51:05.743 回答