【问题标题】:Highcharts multiple series from JSON with different style depending on serie name来自 JSON 的 Highcharts 多个系列,根据系列名称具有不同的风格
【发布时间】:2016-11-18 23:44:14
【问题描述】:

我正在尝试根据 JSON 名称在 Highcharts 上设置不同系列的样式。 这可能吗?

$.each(names, function (i, name) {

    $.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=' + name.toLowerCase() + '-c.json&callback=?',    function (data) {

        seriesOptions[i] = {
            name: name,
            data: data,
            if(name=="GOOG") dashStyle: 'longdash',
        };

Something like this image

Working fiddle

【问题讨论】:

    标签: javascript jquery json highcharts


    【解决方案1】:

    只需在seriesOptions 对象中添加条件即可完成此配置:

    seriesOptions[i] = {
            name: name,
            data: data,
            dashStyle: (name=="GOOG"? 'longdash': ''),
          };
    

    【讨论】:

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