【问题标题】:kendo chart series legend in top on two lines两行顶部的剑道图表系列图例
【发布时间】:2016-02-03 11:54:36
【问题描述】:

我有一个图表的实现,由于屏幕大小的原因,图例必须位于顶部。我的客户抱怨很难看到(在这种情况下)两个系列的标题。

目前显示如下:

[] 系列标题 1 [] 系列标题 2

我想要:

[] 系列标题 1
[] 系列标题 2

设置 legend.position = "right" 像我想要的那样显示它们,但是在侧面,所以它必须设置为 "top"

有什么方法可以做到这一点?

看这里http://plnkr.co/edit/BVPb4AivJuks5VGr6FGz?p=preview

图表配置如下:

{
  "chartArea": {
    "font": "14px/1.714 \"roboto\", \"Arial\", \"Helvetica\", sans-serif",
    "width": 1000,
    "height": 333.3333333333333,
    "background": "",
    "border": {
      "color": ""
    }
  },
  "title": {
    "text": "",
    "font": "14px/1.714 \"roboto\", \"Arial\", \"Helvetica\", sans-serif"
  },
  "legend": {
    "position": "top"
  },
  "seriesDefaults": {
    "markers": {
      "visible": false
    }
  },
  "series": [
    {
      "type": "column",
      "name": "03-02-2016",
      "data": [
        0.110845970287301,
        0.0914614304545012,
        0.0828538550058511,
        0.0828538550056237,
        0.0897167892449033,
        0.178615728107161,
        0.178615728107161,
        0.178615728107161,
        0.178615728107161,
        0.0727362937236649,
        0,
        0
      ],
      "color": "#8f9b49"
    },
    {
      "type": "line",
      "name": "02-02-2016 (perioden før!)",
      "data": [
        0.110709412367669,
        0.0911219388724476,
        0.0911219388722202,
        0.0911219388724476,
        0.0911219388722202,
        0.0235651458583561,
        0.140159626241029,
        0.140159626241029,
        0.140159626241029,
        0.075608331711237,
        0.899526564965754,
        0.899526564965754,
        0.899526564965754,
        0.687138348237795,
        0.431259248819742,
        0.431259248819742,
        0.431259248819515,
        0.400167587908072,
        0.325565217391159,
        0.325565217391386,
        0.325565217391159,
        0.260910866318909,
        0.110845970287073,
        0.110845970287073
      ],
      "color": "#bdc779",
      "border": {
        "width": 1,
        "color": "#dddddd"
      }
    }
  ],
  "valueAxis": {
    "plotBands": [],
    "title": {
      "text": "kWh",
      "background": "none",
      "font": "14px/1.714 \"roboto\", \"Arial\", \"Helvetica\", sans-serif"
    },
    "labels": {
      "format": "{0}",
      "font": "12px/1.714 \"roboto\", \"Arial\", \"Helvetica\", sans-serif"
    },
    "line": {
      "visible": false
    },
    "axisCrossingValue": 0
  },
  "categoryAxis": {
    "majorGridLines": {
      "width": 0
    },
    "title": {
      "text": "Time",
      "background": "none",
      "font": "14px/1.714 \"roboto\", \"Arial\", \"Helvetica\", sans-serif"
    },
    "categories": [
      "00",
      "01",
      "02",
      "03",
      "04",
      "05",
      "06",
      "07",
      "08",
      "09",
      "10",
      "11",
      "12",
      "13",
      "14",
      "15",
      "16",
      "17",
      "18",
      "19",
      "20",
      "21",
      "22",
      "23"
    ],
    "line": {
      "visible": false
    },
    "labels": {
      "padding": {
        "top": 4
      },
      "font": "12px/1.714 \"roboto\", \"Arial\", \"Helvetica\", sans-serif"
    }
  },
  "tooltip": {
    "visible": true,
    "format": "{0}m2",
    "template": "#= series.name # #= category #: #= value #"
  }
}

【问题讨论】:

  • 应该在外部示例中看到一些东西?

标签: charts kendo-ui kendo-chart


【解决方案1】:

将图例 orientation 设置为垂直,然后根据需要设置 height

  legend: {
    position: "top",
    orientation: "vertical",
    height: 50    
  },

【讨论】:

  • 完美。并不是因为 Telerik 的好人不记录他们的东西……而是男孩……有这么多设置,很难找到合适的。谢谢
  • 既然你对剑道了如指掌.....你会碰巧对这个有一个好的答案吗? stackoverflow.com/questions/34269126/…
猜你喜欢
  • 2014-07-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多