【问题标题】:Kendo UI Stock Chart Navigator selector Step by Days Not MonthsKendo UI Stock Chart Navigator 选择器按天而不是按月
【发布时间】:2014-01-09 07:37:10
【问题描述】:

我想要完成的是让导航器部分按天计算,而不是在用户将选择器拖入或拖出时按月计算。我在下面包含了我的来源。一切正常,但我无法让导航器的步骤一次适应一天的步进。任何帮助,将不胜感激。

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

【问题讨论】:

    标签: jquery json kendo-ui kendo-dataviz


    【解决方案1】:

    事实证明,这是将日期作为字符串传入的方式,而不是 JSON 日期字符串格式或新日期(年、月、日)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-03
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      • 1970-01-01
      相关资源
      最近更新 更多