【发布时间】:2018-03-27 20:51:36
【问题描述】:
试图将 text-align:center 属性应用于 highchart 中的标签,但不能,也不知道如何制作。,
小提琴:here its
HTML
<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: 100%; height: 400px; margin: 0 auto">
</div>
JS
Highcharts.chart('容器', {
chart: {
type: 'gauge',
plotBorderWidth: 1,
plotBackgroundImage: null
},
labels: {
items: [{
html: '<span style="text-align:center;">My custom label</span><br><span style="text-align:center;">My Label Data<br>Another Label Data<br>How to apply text align:center property those text</span>',
style: {
left: "195px",
top: "210px"
}
},{
html: '<span style="text-align:center;">My custom label</span><br><span style="text-align:center;">My Label Data<br>Another Label Data<br>How to apply text align:center property those text</span>',
style: {
left: "550px",
top: "210px"
}
},{
html: '<span style="text-align:center;">My custom label</span><br><span style="text-align:center;">My Label Data<br>Another Label Data<br>How to apply text align:center property those text</span>',
style: {
left: "900px",
top: "210px"
}
}]
}
});
【问题讨论】:
-
输出想要什么,添加示例图像
-
图片添加在上面的片段中
-
想像“text-align:center;”一样对齐CSS中的属性
-
jsfiddle.net/k1m00wx3这个sn-p左对齐
标签: highcharts highstock