File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -18,14 +18,20 @@ export default class extends Controller {
1818
1919 deselectAll ( ) {
2020 this . chart . series . forEach ( ( s ) => {
21- s . hide ( ) ;
21+ // Change series visibility to hidden (first param) without redrawing (second param)
22+ s . setVisible ( false , false ) ;
2223 } )
24+ // Redraw chart only once at the end for performance reasons.
25+ this . chart . redraw ( ) ;
2326 }
2427
2528 selectAll ( ) {
2629 this . chart . series . forEach ( ( s ) => {
27- s . show ( ) ;
30+ // Change series visibility to visible (first param) without redrawing (second param)
31+ s . setVisible ( true , false ) ;
2832 } )
33+ // Redraw chart only once at the end for performance reasons.
34+ this . chart . redraw ( ) ;
2935 }
3036
3137}
Original file line number Diff line number Diff line change 11< div data-controller ="highchart " data-highchart-config-value ="<%= config %> ">
22 < div data-highchart-target ="chart "> </ div >
3- < div >
3+ < div class =" pl-3 " >
44 < button type ="button " class ="btn btn-sm btn-secondary " data-action ="click->highchart#selectAll "> Select All</ button >
55 < button type ="button " class ="btn btn-sm btn-info " data-action ="click->highchart#deselectAll "> Deselect All</ button >
66 </ div >
You can’t perform that action at this time.
0 commit comments