我正在用海图尝试条形图。在下面的代码中,我们有如下xaxis类别:【名称1】、【名称2】、【名称3】、【名称4】。
首先,我在react native中使用下面的highcharts代码来开发iOS应用程序。
我正在尝试将名称放在图表(条形图)中每个单独的条形图上,该图表正在工作,但当“类别”数组中的名称文本为v.large时,标题的宽度不会增加&文本将以最小宽度出现在多行中。如果名称是v.large,那么只有我们在图表上得到点文本。
我们可以增加标题的宽度吗?如果是这样,我们如何在iPhone的宽度范围内增加宽度。
chart: {
type: 'bar',
reflow: true,
marginRight: 30,
},
credits: {
enabled: false
},
title: {
align: "left",
text: "A comparison of the businessâ digital health with that of the competitors.",
backgroundColor:'green',
style: {
color: '#808080',
fontWeight: '400',
fontSize: '13px',
}
},
xAxis: {
categories: ['Name1', 'Name2', 'Name3', 'Name4' ],
title: {
align: "left",
},
scrollbar: {
enabled: false
},
labels: {
x: 25,
y: -22,
align: 'left',
useHTML: true,
style: {
fontSize: '13px',
fontFamily: 'Open Sans',
color: '#464646',
backgroundColor: 'green',
},
},
},
yAxis: {
gridLineColor: "transparent",
stackLabels: {
qTotals: [91,99,85,99],
enabled: true,
useHTML: true,
style: {
fontWeight: "bold",
},
formatter: function () {
return this.options.qTotals[this.x];
},
},
tickInterval: 20,
labels: {
enabled: false
},
plotOptions: {
series: {
dataLabels: {
align: 'center',
enabled: false,
crop: false,
overflow: 'none',
verticalAlign: 'top',
y: -50,
style: {
fontWeight: '300',
color: '#808080',
fontSize: '30px',
}
},
pointWidth: 25,
borderWidth: 0,
pointPadding: 10,
stacking: "normal",
states: {
hover: {
enabled: false
}
},
point: {
events: {
click: function (event) {
}
}
}
}
},
series: [
{
name: "",
data: [3, 1, 15, 1],
color: "#f5f6f8",
dataLabels: {
enabled: false
},
},
{
name: "",
color: "#ff0000",
data: [{ y: 97, color: "#0f875a" }, { y: 99, color: "#0f875a" }, { y: 85, color: "#0f875a" }, { y: 99, color: "#0f875a" }]
}
],
}
对于一个示例,我在链接中从HighCharts中提取了一个图表,即条形图。
jsfiddle.net/psre6Lj9/1
我们有一些水果名称,其中“苹果”宽度不够,文本显示在多行中。我想增加标题的宽度。我怎么能做到。