Closed lsnmarcinr closed 6 years ago
I found solution to do that through ChartPointsViewsLayer, but it's mostly not clearly to understand.
Sorry, missed this issue - yes, you can pass the bar layers a view generator as well, you can either re-create the chart each time (with disabled animations) where you generate a highlighted view for the current selection, or you can store the generated views in your own data structure and manipulate these, avoiding having to re-create the chart.
@i-schuetz Okay, what if I want to do the same with ChartStackedBarsLayer? I don't have viewGenerator there, I'm using ChartStackedBarModel as barModels. How can I get bar views and highlight them?
I found method
fileprivate func generateChartPointViews(chartPointModels: [ChartPointLayerModel<T>], chart: Chart) -> [ViewWithChartPoint]
but it has only private access
Stacked bars has also a view generator so the same approach is possible.
These are of course workarounds - ideally the layers should have a method to do this. This isn't difficult to implement, I'll add it to my list but I have no idea when I'll have time - if you want to do a pull request I'd be happy to merge it.
Edit: I'll implement a fix, it's very easy.
I uploaded a fix - now the barViews
array of the plain/stacked bar layers is exposed, so you can just retrieve the bar from it. You have to use master!
Great! Thanks a lot! 👍
@i-schuetz can you merge my pull request? It's required to your last fix.
Can I highlight specific bar on chart?
I have external spreadsheet (table) with values - when I click on value in table I need to highlight specific bar. How can I do that?
Here is preview: