Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用多个系列将图例添加到剑道库存图表中?_Javascript_Html_Kendo Ui - Fatal编程技术网

Javascript 如何使用多个系列将图例添加到剑道库存图表中?

Javascript 如何使用多个系列将图例添加到剑道库存图表中?,javascript,html,kendo-ui,Javascript,Html,Kendo Ui,我们有一个页面,其中有股票图表,除了股票图表,在同一页面中,我们也有网格也在剑道中,股票图表图例没有动态显示。 因此,我尝试在代码中使用多个系列: 但是,当运行此代码时,图例值会重复,如何解决此问题 $(document).ready(function () { var db = new kendo.data.DataSource({ data : data, group: { field: "studentmarks"

我们有一个页面,其中有股票图表,除了股票图表,在同一页面中,我们也有网格也在剑道中,股票图表图例没有动态显示。 因此,我尝试在代码中使用多个系列: 但是,当运行此代码时,图例值会重复,如何解决此问题

$(document).ready(function () {
    var db = new kendo.data.DataSource({
        data : data,
        group: {
            field: "studentmarks"
        }
    });

    db.read();

    $("#Chart").kendoStockChart({
        theme     : $(document).data("kendoSkin") || "silver",
        dataSource: db,
        aggregate : [
            { field: "ID", aggregate: "aggregate", line: "line"}
        ],


        title         : {
            text: "CDR"
        },
        dateField     : "time",
        repeat        : false,
        legend        : {
            position: "right"
        },
        chartArea     : {
            background: ""
        },
        seriesDefaults: {
            type: "line", field: "ID"
        },

        series   : [
            {
                name           : "iad",
                data           : data,
                filter         : "studentmarks",
                color          : "#FC0505",
                width          : 2,
                line           : "line",
                aggregate      : "aggregate",
                visibleInLegend: "studentmarks",

                markers: {
                    visible: false
                },
                tooltip: {
                    visible: true,
                    format : "{0}%"
                }
            },
            {
                name   : "pht",
                filter : "studentmarks",
                data   : data,
                axis   : "",
                color  : "#2605FC",
                width  : 2,
                line   : "line",
                markers: {
                    visible: true
                },
                tooltip: {
                    visible: true,
                    format : "{0}"
                }
            },
            {
                name   : "phone",
                filter : "studentmarks",
                data   : data,
                axis   : "",
                color  : "#ED9AA5",
                width  : 2,
                line   : "line",
                markers: {
                    visible: true
                },
                tooltip: {
                    visible: true,
                    format : "{0}%"
                }

            },
            {
                name   : "cbs",
                filter : "studentmarks",
                data   : data,
                axis   : "",
                color  : "#9AA5ED",
                visible: true,
                opacity: .4,
                width  : 2,
                line   : "line",
                markers: {
                    visible: true
                },
                tooltip: {
                    visible: true,
                    format : "{0}%"
                }
            }
        ],
        valueAxis: [
            {
                title    : { text: "" },
                name     : "mos",
                majorUnit: 0.5,
                max      : 5.0,
                min      : 0
            },
            {
                name     : "ink",
                title    : { text: "" },
                min      : 0,
                max      : 6727.14,
                majorUnit: 1000,
                minorUnit: 500
            }
        ],


        navigator: {
            series: {
                type     : "area",
                color    : "red",
                field    : "time",
                stack    : "true",
                value    : "studentmarks",
                data     : data,
                aggregate: "min",
                name     : "sai",
                select   : {
                    from: "2009-01-01 17:08:04",
                    to  : "2013-12-24 20:30:26"
                },
                labels   : { color: "green", visible: false },
                tooltip  : { background: "green", format: "{0}", color: "white", visible: true }
            }
        }
    });

});

关闭图例并创建自己的图例。您可以更灵活地完全按照自己的意愿行事。

您的
数据是什么样子的?您是否意识到
定义,定义
字段
两次(第一次是
“ID”
,第二次是
“studentmarks”