我必须自定义区域图表类型中的标签符号,就像它可以在线图表类型中那样:
我有这样的代码:
Highcharts.chart('container', {
chart: {
type: 'area'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
marker: {
enabled: false
}
}
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});我的传说是这样的:

我希望有这样的:

我不能编辑css样式,这必须是一个独家定制的只有这个图表。
我使用的是角7.2,我用它导入了High图表:
import {Chart} from 'angular-highcharts';发布于 2019-02-20 15:23:31
您可以通过手动设置图例符号的宽度和高度来实现这一点。您需要将squareSymbol设置为false以允许具有不同的宽度和高度值:
legend: {
squareSymbol: false,
symbolHeight: 3,
symbolWidth: 20
},例如。
编辑
如果要将符号与文本对齐,请使用useHTML: true并设置lineHeight。
legend: {
useHTML: true,
itemStyle: {
lineHeight: "23px"
},
squareSymbol: false,
symbolHeight: 3,
symbolWidth: 20
},发布于 2019-02-20 15:25:35
将area.prototype.drawLegendSymbol方法与line.prototype.drawLegendSymbol.交换在纯JS中,这已经足够了:
Highcharts.seriesTypes.area.prototype.drawLegendSymbol =
Highcharts.seriesTypes.line.prototype.drawLegendSymbol;在角度上,你可以用这样的方式来包装高图集:
(function(factory) {
if (typeof module === "object" && module.exports) {
module.exports = factory;
} else {
factory(Highcharts);
}
})(function(Highcharts) {
Highcharts.seriesTypes.area.prototype.drawLegendSymbol =
Highcharts.seriesTypes.line.prototype.drawLegendSymbol;
});博士:https://github.com/highcharts/highcharts-angular#to-load-a-wrapper
https://stackoverflow.com/questions/54788810
复制相似问题