尝试创建一个包含3列系列和1个散点系列的组合图表;列应为100%并且散布在其上。当我使用plotOptions:{column:{stacking:“percent”}时,列在绘图区域中最大化,但散布系列到达图表的底部;当用plotOptions替换:{column:{stacking:“normal”}时,它显示良好但列没有最大化绘图区域。想法?
Highcharts.chart('container', {
chart: {
ignoreHiddenSeries: false,
backgroundColor: "#FFFFFF",
width: 509,
height: 400,
borderColor: "#FFFFFF",
borderWidth: 1,
plotShadow: false
},
title: {
text: "Your organization in comparison",
style: {color: "#333333", fontFamily: "Arial", fontSize: 16, fontWeight: "bold"}
},
legend: {
enabled: true,
verticalAlign: "bottom",
align: "center",
symbolRadius: 0,
style: {color: "#333333", fontFamily: "Arial", fontSize: 13}
},
plotOptions: {
column: {stacking: "percent"},
// column: {stacking: "normal"},
series: {animation: true}},
tooltip: {enabled: false},
yAxis: {title: {text: null}, labels: {enabled: false}, gridLineWidth: 0, reversedStacks: false},
xAxis: {
title: {text: null},
categories: ['Experience', 'Security', 'Management'],
labels: {enabled: true, style: {color: "#333333", fontFamily: "Arial", fontSize: 13}},
gridLineWidth: 0,
reversedStacks: false
},
series: [{
type: "column",
name: "Low",
invertIfNegative: false,
color: "#002E73",
showInLegend: true,
data: [{y: 0.42}, {y: 0.42}, {y: 0.48}],
dataLabels: {
enabled: false,
verticalAlign: "top",
style: {color: "#FFFFFF", fontFamily: "Arial", fontSize: 13, textOutline: ""}
}
}, {
type: "column",
name: "Medium",
invertIfNegative: false,
color: "#297EFF",
showInLegend: true,
data: [{y: 0.37}, {y: 0.47}, {y: 0.36}],
dataLabels: {enabled: false}
}, {
type: "column",
name: "High",
invertIfNegative: false,
color: "#B8D4FF",
showInLegend: true,
data: [{y: 0.21}, {y: 0.11}, {y: 0.16}],
dataLabels: {enabled: false}
}, {
type: "scatter",
name: "Your organization today",
invertIfNegative: false,
color: "#FFC000",
lineWidth: 0,
marker: {enabled: true, radius: 14},
states: {hover: {lineWidthPlus: 0}},
showInLegend: true,
data: [{y: 0.21}, {y: 0.21}, {y: 0.24}],
dataLabels: {enabled: false}
}],
credits: {enabled: false}
})
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="width: 600px; height: 300px; margin: 0 auto"></div>
答案 0 :(得分:-1)
您应该使用多个轴来制作组合图表。
请在此处参阅有关YAxis的文件:http://api.highcharts.com/highcharts/yAxis
我已经修改了你的代码。请试试!
Highcharts.chart('container', {
chart: {
ignoreHiddenSeries: false,
backgroundColor: "#FFFFFF",
width: 509,
height: 400,
borderColor: "#FFFFFF",
borderWidth: 1,
plotShadow: false
},
title: {
text: "Your organization in comparison",
style: {
color: "#333333",
fontFamily: "Arial",
fontSize: 16,
fontWeight: "bold"
}
},
legend: {
enabled: true,
verticalAlign: "bottom",
align: "center",
symbolRadius: 0,
style: {
color: "#333333",
fontFamily: "Arial",
fontSize: 13
}
},
plotOptions: {
column: {
stacking: "percent"
},
// column: {stacking: "normal"},
series: {
animation: true
}
},
tooltip: {
enabled: false
},
// Create Multiple axes
yAxis: [{
title: {
text: null
},
labels: {
enabled: false
},
gridLineWidth: 0,
reversedStacks: false
}, {
title: {
text: null
},
labels: {
enabled: false
},
gridLineWidth: 0,
reversedStacks: false
}],
xAxis: {
title: {
text: null
},
categories: ['Experience', 'Security', 'Management'],
labels: {
enabled: true,
style: {
color: "#333333",
fontFamily: "Arial",
fontSize: 13
}
},
gridLineWidth: 0,
reversedStacks: false
},
series: [{
type: "column",
name: "Low",
invertIfNegative: false,
color: "#002E73",
showInLegend: true,
data: [{
y: 0.42
}, {
y: 0.42
}, {
y: 0.48
}],
dataLabels: {
enabled: false,
verticalAlign: "top",
style: {
color: "#FFFFFF",
fontFamily: "Arial",
fontSize: 13,
textOutline: ""
}
}
}, {
type: "column",
name: "Medium",
invertIfNegative: false,
color: "#297EFF",
showInLegend: true,
data: [{
y: 0.37
}, {
y: 0.47
}, {
y: 0.36
}],
dataLabels: {
enabled: false
}
}, {
type: "column",
name: "High",
invertIfNegative: false,
color: "#B8D4FF",
showInLegend: true,
data: [{
y: 0.21
}, {
y: 0.11
}, {
y: 0.16
}],
dataLabels: {
enabled: false
}
}, {
yAxis: 1, // Define axis will be use here
type: "scatter",
name: "Your organization today",
invertIfNegative: false,
color: "#FFC000",
lineWidth: 0,
marker: {
enabled: true,
radius: 14
},
states: {
hover: {
lineWidthPlus: 0
}
},
showInLegend: true,
data: [{
y: 0.21
}, {
y: 0.21
}, {
y: 0.24
}],
dataLabels: {
enabled: false
}
}],
credits: {
enabled: false
}
})
&#13;
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<div id="container" style="width: 600px; height: 300px; margin: 0 auto"></div>
&#13;