highcharts / highcharts-ios

iOS wrapper for Highcharts.
Other
127 stars 39 forks source link

Custom series marker symbol - disable series does not grayscale symbol #330

Closed skuske closed 4 years ago

skuske commented 4 years ago

I am using a custom series marker symbol, and that works just fine as it should.

However, if I hide the series from the chart, the marker symbol does not get grayscaled in the Legend, just as it does for the default marker symbols.

How can I get the custom marker symbol to grayscale in the Legend if the related series is hidden from the chart?

Many thanks for any help.

grayscale

ihnatmoisieiev commented 4 years ago

Hello @skuske,

we prepared a workaround for you. Please try:

let chart = HIChart()
chart.events = HIEvents()
chart.events.load = HIFunction(jsFunction: "function() { var r = this.renderer; var filter = r.definition({ tagName: 'filter', id: 'grayscale', children: [{ tagName: 'feColorMatrix', type: 'matrix', values: '0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0' }] }); const style = document.createElement('style'); style.textContent = ` .highcharts-legend-item-hidden image { filter: url(#grayscale); }`; document.head.append(style); }")
options.chart = chart
skuske commented 4 years ago

@ihnatmoisieiev

What should I say? BRILLIANT! Works perfect. Many, many thanks!

ihnatmoisieiev commented 4 years ago

@skuske we also have reported it in main repo: https://github.com/highcharts/highcharts/issues/14066

skuske commented 4 years ago

@ihnatmoisieiev

Thanks. However, I see this as a (minor) bug and not necessarily as an additional feature ... ;o)

But thanks again for a working solution. Much appreciated. Great service, as always!