Kendo UI股票图表导航器选择器逐个天而不是几个月

时间:2014-01-09 07:37:11

标签: jquery json kendo-ui kendo-dataviz

我想要实现的是让导航器部分逐步增加,而不是在用户将选择器拖入或移出时踩一个月。我在下面列出了我的来源。一切正常,但我无法让导航仪的步骤适应一天一天的步进。任何帮助,将不胜感激。

$.ajax({
    // the url to the service
    url: "/api/TrendAnalysis",
    // the format that the data should be in when
    // it is returned
    contentType: "json",
    // the function that executes when the server
    // responds to this ajax request successfully
    success: function (data) {
        $("#progressBar").toggle();
        trend = data;

        // put the JSON response current and previous data
        // for the selected metric on the stock chart
        trendgraph.element.kendoStockChart({
            theme: trendgraph.theme,
            dataSource: {
                data:trend
            },
            title: {
                text: "Trend Analysis (Traffic)",
                visible: false
            },
            chartArea: {
                background: trendgraph.background
            },
            dateField:  Date.parse(trend.currentdate),
            series: [{
                type: "line",
                field: trendgraph.currentmetric,
                categoryField: trendgraph.currentdate,
                missValues: "zero",
                color: "#1589FF",
                tooltip: {
                    visible: true,
                    template: "TY #=value#"
                }
            }, {
                type: "line",
                field: trendgraph.previousmetric,
                missValues: "zero",
                tooltip: {
                    visible: true,
                    template: "LY #=value#"
                },
                color: "#ff8a14"
            }],
            navigator: {
                //dateField: trendgraph.currentdate,

                categoryAxis: {
                    baseUnit: "days",
                },
                series: [{
                    baseUnit: "fit",
                    categoryField: trendgraph.currentdate,
                    type: "area",
                    field: trendgraph.currentmetric,
                    missingValues: "zero"
                }]
                /*select: {
                    from: trendgraph.from,
                    to: trendgraph.to
                }*/
            },
            valueAxis: {
                labels: {
                    //visible: false,
                    format: trendgraph.format.Number,
                    step: trendgraph.axisstep
                }
            },
            categoryAxis:{
                field: trendgraph.currentdate,
                baseUnit: "fit"
            },
            tooltip: {
                visible: true,
                format: trendgraph.format.Number
            },
            select: Select,
            zoom: Select
        });
    }

    });
function Select(e) {
    displayDateRange(kendo.toString(e.to,'d'), kendo.toString(e.from, 'd'));
}

1 个答案:

答案 0 :(得分:0)

原来这是日期作为字符串传递的方式,而不是JSON日期字符串格式或新日期(年,月,日)。