Skip to content

Commit

Permalink
fix: bring back the legend symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
edoardo committed Sep 27, 2023
1 parent 541eed8 commit 7068772
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/visualizations/config/generators/highcharts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ function drawLegendSymbolWrap() {
H.seriesTypes.column.prototype,
'drawLegendSymbol',
function (proceed, legend, item) {
const legendItem = item.legendItem

if (this.options.legendSet?.legends?.length) {
const ys = legend.baseline - legend.symbolHeight + 1, // y start
x = legend.symbolWidth / 2 > 8 ? legend.symbolWidth / 2 : 8, // x start
Expand All @@ -32,7 +34,7 @@ function drawLegendSymbolWrap() {
.attr({
fill: legends[legends.length >= 5 ? 1 : 0].color,
})
.add(this.legendGroup)
.add(legendItem.group)
this.chart.renderer
.path(['M', x, ye, 'A', 1, 1, 0, 0, 0, x, ys, 'V', ye])
.attr({
Expand All @@ -42,13 +44,14 @@ function drawLegendSymbolWrap() {
: legends.length - 1
].color,
})
.add(this.legendGroup)
.add(legendItem.group)
} else {
var options = legend.options,
symbolHeight = legend.symbolHeight,
square = options.squareSymbol,
symbolWidth = square ? symbolHeight : legend.symbolWidth
item.legendSymbol = this.chart.renderer

legendItem.symbol = this.chart.renderer
.rect(
square ? (legend.symbolWidth - symbolHeight) / 2 : 0,
legend.baseline - symbolHeight + 1,
Expand All @@ -60,7 +63,7 @@ function drawLegendSymbolWrap() {
.attr({
zIndex: 3,
})
.add(item.legendGroup)
.add(legendItem.group)
}
}
)
Expand Down

0 comments on commit 7068772

Please sign in to comment.