0

我想在工具提示中显示所有数据点。我的数据有 2 个系列,一个系列有 2 个点,一个点有 3 个字段(值、基数和日期)

我试试这个http://trykendoui.telerik.com/OCeB但 x 轴重复

如果有解决方案我想使用数据源

4

1 回答 1

0

通常系列中的 x 值不应重复,您有两个选项来修复图表:

选项 1: 在每个数据点上定义两个系列的值

        var internetUsers = [
        {
          "S1Value" : 1,
          "S1base" : 2,
          "S2Value" : 3,
          "S2base" : 2,
          "date" : 2011
        },
        {
          "S1Value" : 5,
          "S1base" : 6,
          "S2Value" : 4,
          "S2base" : 7,              
          "date" : 2013
        },
      ]

并为每个定义一个工具提示:

           series: [{
                field: "S1Value",
                name: "United States", 
                tooltip: {
                  visible: true,
                  background: "#FFFFFF",
                  template:
                    "#= series.name # <br /> " +
                        "Fecha = #= category # <br /> " +
                        "Valor = #= value # <br/> " +
                        "Base = #= dataItem.S1base # ",
                  format: "n2",
            }
            },{
                field: "S2Value",
                name: "Mexico", 
                  tooltip: {
                  visible: true,
                  background: "#FFFFFF",
                  template:
                    "#= series.name # <br /> " +
                        "Fecha = #= category # <br /> " +
                        "Valor = #= value # <br/> " +
                        "Base = #= dataItem.S1base # ",
                  format: "n2",
            }
            }

http://trykendoui.telerik.com/OCeB/2

选项 2:

将您的系列分成两部分:

        var internetUsersS1 = [
        {
          "S1" : 1,
          "base" : 2,
          "date" : 2011
        },
        {
          "S1" : 5,
          "base" : 6,
          "date" : 2013
        }
      ]
      var internetUsersS2 = [
          {
          "S2" : 3,
          "base" : 2,
          "date" : 2011


        },
          {
          "S2" : 4,
          "base" : 7,
          "date" : 2013
        }
      ]

...现在给每个系列它自己的数据源:

 series: [{
                data: internetUsersS1,
                field: "S1",
                name: "United States"
            },{
                data: internetUsersS2,
                field: "S2",
                name: "Mexico"
            }
            ]

http://trykendoui.telerik.com/OCeB/3

于 2014-04-29T14:40:02.017 回答