我在Highchart中有一个超过10个系列的折线图。当图表被绘制为超过2个月启用了系列标记的数据时,图表看起来很拥挤并且没有意义,所以我禁用了系列标记。禁用系列标记时,图例中的标记也会消失。我想要的是仅在系列中禁用标记并在图例中启用标记。我怎样才能做到这一点?有人可以帮帮我吗?
谢谢, 落基
答案 0 :(得分:5)
您有两种选择:
示例:
var chart = new Highcharts.Chart({
chart: {
renderTo: 'container'
},
plotOptions: {
series: {
marker: {
enabled: false
}
}
},
series: [{
data: [],
name: 'test',
id: 'id-1',
color: 'red',
marker: {
enabled: true
}
}, {
linkedTo: 'id-1',
color: 'red',
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0]
}]
});
答案 1 :(得分:1)
你可以做这样的事情
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/stock/highstock.js"></script>
<script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
<div id="container" style="height: 400px; min-width: 310px"></div>
</body>
</html>
<script type="text/javascript">
$(function () {
Highcharts.Series.prototype.drawPoints = function () { };
$('#container').highcharts('StockChart', {
title: {
text: 'This is yongjing.chen test 3'
},
legend: { enabled: true, symbolWidth: 50 },
plotOptions: {
series: {
marker: {
enabled: true, radius: 6, symbol: 'square'
}
}
},
series: [{
data: [1, 171.5, 306.4, 2.2, 300, 2, 200],
name: 'CPU',
id: 'id-1',
color: 'red'
}]
});
});
</script>