highcharts 是否删除折线图图例符号上的删除线?

dy2hfwbg  于 2022-11-10  发布在  Highcharts
关注(0)|答案(2)|浏览(232)

我在折缐图上使用预先定义的高值图符号,而且只想显示符号,不想同时显示折缐。我发现泡泡图也可以,但是当我将图表类型从泡泡图变更为折缐图时,会出现删除缐:https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/bubble-symbol/。有什么想法我可以如何对抗这个?提前感谢!

chart: {
        type: 'bubble'
    },

    title: {
        text: 'Highcharts Bubbles with symbols'
    },

    series: [{
        data: [
            [97, 36, 79],
            [94, 74, 60],
            [68, 76, 58],
            [64, 87, 56],
            [68, 27, 73],
            [74, 99, 42],
            [7, 93, 87],
            [51, 69, 40],
            [38, 23, 33],
            {
                x: 57,
                y: 0,
                z: 31,
                marker: {
                    symbol: 'triangle',
                    lineColor: 'red',
                    fillColor: 'rgba(255,0,0,0.5)'
                },
                dataLabels: {
                    enabled: true,
                    format: 'Individual marker'
                }
            }
        ],
        marker: {
            symbol: 'square'
        },
        name: 'Square'
    }, {
        data: [
            [25, 10, 87],
            [2, 75, 59],
            [11, 54, 8],
            [86, 55, 93],
            [5, 3, 58],
            [90, 63, 44],
            [91, 33, 17],
            [97, 3, 56],
            [15, 67, 48],
            [54, 25, 81]
        ],
        marker: {
            symbol: 'diamond'
        },
        name: 'Diamond'
    }, {
        data: [
            [47, 47, 21],
            [20, 12, 4],
            [6, 76, 91],
            [38, 30, 40],
            [57, 98, 64],
            [61, 17, 10],
            [83, 60, 13],
            [67, 78, 75],
            [64, 12, 10],
            [30, 77, 82]
        ],
        marker: {
            symbol: 'url(https://www.highcharts.com/samples/graphics/earth.svg)'
        },
        name: 'Earth'
    }]

});
kx5bkwkv

kx5bkwkv1#

我认为你可以用散点序列类型来实现它。
演示:https://jsfiddle.net/BlackLabel/8gpnx90v/

chart: {
    type: 'scatter'
  },

应用编程接口:https://www.highcharts.com/docs/chart-and-series-types/scatter-chart

jgovgodb

jgovgodb2#

回答有点晚,但如果将symbolWidth设置为与符号半径相同的值,则会隐藏图例中的线条:

legend: {
      layout: 'horizontal',
      align: 'center',
      verticalAlign: 'bottom',
      symbolWidth: 6
  },  
  plotOptions: {
      line: {
        marker: {
          symbol: 'circle',
          radius: 6
        }
      }
  },

相关问题