Google charts hide only some episodes in the legend

Is it possible to hide only some episodes in the legend.

I have a combo chart containing:

  • quantity A
  • quantity B
  • quantity C

displayed as a single column with a footer.

and:

  • sum / second A
  • sum / second B
  • quantity / second C

all are displayed as separate lines within the same chart.

Now "quantity A" has the same color as "sum / second A". This color should be displayed only in the legend and marked as "A".

Is it possible to do this using Google Charts? If so, how?

+6
source share
1 answer

You can remove specific entries from the legend by setting the parameters of the series.<series index>.visibleInLegend to false for the series that you want to hide from the legend. As an example, if the quantity / second series is the 4th, 5th, and 6th series of data in your data set, you can create a series parameter like this to hide them:

 series: { 3: { visibleInLegend: false }, 4: { visibleInLegend: false }, 5: { visibleInLegend: false } } 

The series index only counts data columns, not DataTable columns, so ignore the domain column and any special role columns that you use when defining the series index.

+8
source

Source: https://habr.com/ru/post/975297/


All Articles