ui.Chart.setSeriesNames
Returns a copy of this chart with updated series names.
Usage | Returns |
---|
Chart.setSeriesNames(seriesNames, seriesIndex) | ui.Chart |
Argument | Type | Details |
---|
this: ui.chart | ui.Chart | The ui.Chart instance. |
seriesNames | Dictionary|Dictionary | New series names. If it's a string, the name of the series at seriesIndex is set to seriesNames. If it's a list, the value at index i in the list is used as a label for series number i. If it's a dictionary or an object, it's treated as a map from existing series names to new series names. In the last two cases, seriesIndex is ignored. |
seriesIndex | Number, optional | The index of the series to rename. Ignored if seriesNames is a list or dictionary. Series are 0-indexed. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["The `Chart.setSeriesNames` function updates the names of series within a chart."],["You can update series names using a single string, a list of names, or a dictionary mapping old names to new ones."],["When using a string or list, an optional `seriesIndex` argument specifies the target series (0-based indexing)."],["The function returns a modified copy of the chart with the updated series names, leaving the original chart unchanged."]]],["The `Chart.setSeriesNames` function updates series names within a chart. It accepts `seriesNames` as either a string, list, or dictionary. A string renames a specific series by `seriesIndex`. A list sets series names based on their index. A dictionary maps existing series names to new ones. The function returns a new chart (`ui.Chart`) with the updated series names, leaving the original chart untouched. The `seriesIndex` argument is used only when a single string is passed to `seriesNames`.\n"]]