繁体   English   中英

Kendo UI Stock Chart Navigator选择器,按天而不是几个月

[英]Kendo UI Stock Chart Navigator selector Step by Days Not Months

我要完成的工作是使导航器部分逐步进行,而不是在用户将选择器拖曳至或从中拖出时逐月进行。 我在下面列出了我的消息来源。 一切正常,但我无法获得导航器的支持,以适应一天只执行一次。 任何帮助,将不胜感激。

$.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'));
}

事实证明,这是将日期作为字符串传递的方式,而不是采用JSON Date字符串格式或新的Date(year,month,day)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM