我在高图JSFiddle中使用组合图表。超过某一点时,饼图会出现折线图并阻碍其可见性。HighCharts组合图表
如何根据折线图的值动态地上/下饼图。
这是我的高楼代码。
$(function() {
$('#container').highcharts({
chart: {
},
title: {
text: 'Combination chart'
},
xAxis: {
categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
},
tooltip: {
formatter: function() {
var s;
if (this.point.name) { // the pie chart
s = ''+
this.point.name +': '+ this.y +' fruits';
} else {
s = ''+
this.x +': '+ this.y;
}
return s;
}
},
labels: {
items: [{
html: 'Total fruit consumption',
style: {
left: '40px',
top: '8px',
color: 'black'
}
}]
},
series: [{
type: 'spline',
name: 'Average',
data: [3, 6, 3, 6.33, 3.33],
marker: {
lineWidth: 2,
lineColor: Highcharts.getOptions().colors[3],
fillColor: 'white'
}
}, {
type: 'pie',
name: 'Total consumption',
data: [{
name: 'Jane',
y: 13,
color: Highcharts.getOptions().colors[0] // Jane's color
}, {
name: 'John',
y: 23,
color: Highcharts.getOptions().colors[1] // John's color
}, {
name: 'Joe',
y: 19,
color: Highcharts.getOptions().colors[2] // Joe's color
}],
center: [100, 80],
size: 100,
showInLegend: false,
dataLabels: {
enabled: false
}
}]
});
});
我想要类似this的东西。你看到饼图和样条曲线没有冲突。但就我而言,样条曲线的值很高,饼图阻碍了样条的可见性。饼图应自动调整自己在样条上方或下方的某处。
我该怎么做?
正是你想要的。 plz给出输出样本。 –
我想要这样的[this](http://www.highcharts.com/demo/combo)。你看到饼图和样条曲线没有冲突。但在我的情况下,样条曲线的值很高,饼图妨碍了样条线的可见性。饼图应该自动调整自己在样条上方或下方的某处。 – PythonEnthusiast
我认为你可以考虑另一种解决方案:使用两个不同的图表,一个用于饼图,一个用于样条线。现在使用一些可拖动的插件用于饼图容器,并且用户将被允许在该饼图中移动。如果你只有6个类别,你可能会发现一些需要的派对空间,但有时候这可能是不可能的。 –