Class Configuration

java.lang.Object
com.vaadin.flow.component.charts.model.AbstractConfigurationObject
com.vaadin.flow.component.charts.model.Configuration
All Implemented Interfaces:
ChartConfiguration, Serializable

public class Configuration extends AbstractConfigurationObject implements ChartConfiguration
Chart's configuration root object containing all the child objects that are used to configure chart, axes, legend, titles etc.
See Also:
  • Constructor Details

    • Configuration

      public Configuration()
  • Method Details

    • getAccessibility

      public Accessibility getAccessibility()
      See Also:
    • setAccessibility

      public void setAccessibility(Accessibility accessibility)
      Sets options for configuring accessibility for the chart.
      Parameters:
      accessibility -
    • getChart

      public ChartModel getChart()
      See Also:
    • setChart

      public void setChart(ChartModel chart)
      Sets options regarding the chart and plot areas as well as general chart options.
      Parameters:
      chart - ChartModel to set, not null
    • getSeries

      public List<Series> getSeries()
      See Also:
    • addSeries

      public void addSeries(Series series)
      Adds a single series to the list of series in this configuration.
      Parameters:
      series -
    • setSeries

      public void setSeries(List<Series> series)
      Sets the actual series to append to the chart. Series objects contains the data content (individual points/columns etc.) of the plot. The series object could have data (the content), name, labels, tooltips, markers etc.

      In addition to the attributes listed above, any member of the plotOptions for that specific type of plot can be added to a series individually. For example, even though a general lineWidth is specified in AbstractPlotOptions, an individual lineWidth can be specified for each series (e.g. to enable each series have different lineWidth).

      If the chart is already rendered on the client, Chart.drawChart(boolean) needs to be called with true as parameter so the configuration object is resent to the client.
      Parameters:
      series -
    • setSeries

      public void setSeries(Series... series)
      Parameters:
      series -
      See Also:
    • getDrilldown

      public Drilldown getDrilldown()
      Configuration options for drill down, the concept of inspecting increasingly high resolution data through clicking on chart items like columns or pie slices.
      Returns:
      current drilldown configuration
    • getTitle

      public Title getTitle()
      See Also:
    • setTitle

      public void setTitle(Title title)
      The main title of the chart.
      Parameters:
      title -
    • setTitle

      public void setTitle(String text)
      Sets the new chart's main title to the given string
      Parameters:
      text - Text of title
    • getSubTitle

      public Subtitle getSubTitle()
      Returns:
      The chart's subtitle
    • setSubTitle

      public void setSubTitle(String text)
      Sets the subtitle to the given text
      Parameters:
      text - Text of subtitle
    • setSubTitle

      public void setSubTitle(Subtitle subTitle)
      Sets the chart's subtitle
      Parameters:
      subTitle -
    • getxAxis

      public XAxis getxAxis()
      Returns the X-axis or category axis. Normally this is the horizontal axis, though if the chart is inverted this is the vertical axis. In case of multiple axes defined, the first axis is returned. An axis will be created if no axis is defined.
      Returns:
      the X-axis or category axis.
    • getNumberOfxAxes

      public int getNumberOfxAxes()
      Returns:
      the number of X-axes defined
    • getxAxis

      public XAxis getxAxis(int index)
      Returns:
      The X-axis with the given index or null if the index is not valid
    • removexAxes

      public void removexAxes()
      Removes all defined X-axes
    • addxAxis

      public void addxAxis(XAxis axis)
      Adds an X-axis to the configuration
      Parameters:
      axis - The X-Axis to add.
      See Also:
    • getyAxis

      public YAxis getyAxis()
      Returns the Y-axis or value axis. Normally this is the vertical axis, though if the chart is inverted this is the horizontal axis. In case there are multiple axes defined (a list), only the first axis is returned. If none exist, a Y-axis will be created.
      Returns:
      The first Y-axis
      See Also:
    • getNumberOfyAxes

      public int getNumberOfyAxes()
      Returns:
      The number of Y-axes defined
    • getyAxis

      public YAxis getyAxis(int index)
      Returns:
      The Y-axis with the given index or null if the index is not valid
    • removeyAxes

      public void removeyAxes()
      Removes all defined Y-axes
    • addyAxis

      public void addyAxis(YAxis axis)
      Adds a Y-axis.
      Parameters:
      axis - The Y-axis to add.
      See Also:
    • getyAxes

      public AxisList<YAxis> getyAxes()
      Returns:
      A list of all defined Y-axes, null if none are found.
    • getzAxis

      public ZAxis getzAxis()
      Returns the Z-axis. In case there are multiple axes defined (a list), only the first axis is returned. If none exist, a Z-axis will be created.
      Returns:
      The first Z-axis
      See Also:
    • getNumberOfzAxes

      public int getNumberOfzAxes()
      Returns:
      The number of Z-axes defined
    • getzAxis

      public ZAxis getzAxis(int index)
      Returns:
      The Z-axis with the given index or null if the index is not valid
    • removezAxes

      public void removezAxes()
      Removes all defined Z-axes
    • addzAxis

      public void addzAxis(ZAxis axis)
      Adds a Z-axis.
      Parameters:
      axis - The Z-axis to add.
      See Also:
    • getzAxes

      public AxisList<ZAxis> getzAxes()
      Returns:
      A list of all defined Z-axes, null if none are found.
    • getTooltip

      public Tooltip getTooltip()
      Returns:
      the tooltip options for this chart. If none have been set, a new Tooltip object with the default options is created.
      See Also:
    • setTooltip

      public void setTooltip(Tooltip tooltip)
      Sets the options for the tooltip that appears when the user hovers over a series or point.
      Parameters:
      tooltip -
    • getCredits

      public Credits getCredits()
      See Also:
    • setCredits

      public void setCredits(Credits credits)
      Sets/changes the credits label that is added in the lower right corner of the chart.
      Parameters:
      credits -
    • disableCredits

      public void disableCredits()
      Disables the credits by setting a Credits object with the enabled property set to false.
    • getLegend

      public Legend getLegend()
      See Also:
    • setLegend

      public void setLegend(Legend legend)
      Sets the legend. The legend is a box containing a symbol and name for each series item or point item in the chart.
      Parameters:
      legend -
    • getPlotOptions

      public Collection<AbstractPlotOptions> getPlotOptions()
      Returns all plot options used by this configuration.
      See Also:
    • getPlotOptions

      public AbstractPlotOptions getPlotOptions(ChartType type)
      Returns the plot options for a specific chart type used by this configuration.

      Returns null if no plot options was found for the type

      Parameters:
      type -
      See Also:
    • setPlotOptions

      public void setPlotOptions(AbstractPlotOptions... plotOptions)
      Sets component-wide default plot options.

      If the component contains several chart types, this method can be called with several plot option types. Subsequent calls with the same plot type will replace previous options for that specific chart type i.e only the latest options for each chart type is honored.

      PlotOptionsSeries is a special plot options type that can be used to define rules for all chart types.

      Parameters:
      plotOptions -
      See Also:
    • addPlotOptions

      public void addPlotOptions(AbstractPlotOptions plotOptions)
      Adds plot options
      Parameters:
      plotOptions -
      See Also:
    • setExporting

      public void setExporting(Boolean exporting)
      Sets whether to enable exporting
      Parameters:
      exporting -
      See Also:
    • setExporting

      public void setExporting(Exporting exporting)
      Sets the exporting module settings.
      Parameters:
      exporting -
      See Also:
    • getExporting

      public Exporting getExporting()
      See Also:
    • isExporting

      public Boolean isExporting()
      See Also:
    • getPane

      public Pane getPane()
      See Also:
    • addPane

      public void addPane(Pane pane)
      Adds a pane. This applies only to polar charts and angular gauges. This configuration object holds general options for the combined X and Y -axes set. Each XAxis or YAxis can reference the pane by index.
      Parameters:
      pane -
    • setRangeSelector

      public void setRangeSelector(RangeSelector rangeSelector)
      Set settings for range selector.

      This is only valid if the chart is configured to use timeline. See Chart.setTimeline(Boolean)}

      Parameters:
      rangeSelector -
      See Also:
    • getRangeSelector

      public RangeSelector getRangeSelector()
      See Also:
    • getScrollbar

      public Scrollbar getScrollbar()
      See Also:
    • setScrollbar

      public void setScrollbar(Scrollbar scrollbar)
      Set configuration for the scrollbar. Allows panning over the X axis of the chart
      Parameters:
      scrollbar -
    • getNoData

      public NoData getNoData()
      See Also:
    • setNoData

      public void setNoData(NoData noData)
      Set options for displaying a message when no data is available. The actual text to display is set in the Lang.setNoData(String)
      Parameters:
      noData -
    • getNavigation

      public Navigation getNavigation()
      See Also:
    • setNavigation

      public void setNavigation(Navigation navigation)
      Set options for buttons and menus appearing in the exporting module.
      Parameters:
      navigation -
    • getLoading

      public Loading getLoading()
      See Also:
    • setLoading

      public void setLoading(Loading loading)
      Set loading options control the appearance of the loading screen that covers the plot area on chart operations.
      Parameters:
      loading -
    • getNavigator

      public Navigator getNavigator()
      See Also:
    • setNavigator

      public void setNavigator(Navigator navigator)
      Set configuration for the navigator
      Parameters:
      navigator -
    • getTime

      public Time getTime()
      See Also:
    • setTime

      public void setTime(Time time)
      Set configuration for time options
      Parameters:
      time -
    • reverseListSeries

      public void reverseListSeries()
      Reverses the ListSeries (transposes it such that categories would be series names and vice versa) to help stacking throws IllegalStateException if series are not ListSeries type
    • fireAxesRescaled

      public void fireAxesRescaled(Axis axis, Number minimum, Number maximum, boolean redraw, boolean animate)
      Fires axis rescaled event.
      Specified by:
      fireAxesRescaled in interface ChartConfiguration
      Parameters:
      axis - Axis that is the source of the event.
      minimum - New minimum.
      maximum - New maximum.
      redraw - Whether or not to redraw.
      animate - Whether or not to animate.
    • resetZoom

      public void resetZoom()
      Reset zoom level by setting axes extremes to null
    • resetZoom

      public void resetZoom(boolean redraw, boolean animate)
      Reset zoom level by setting axes extremes to null
      Parameters:
      redraw - Whether or not to redraw.
      animate - Whether or not to animate.
    • addChangeListener

      public void addChangeListener(ConfigurationChangeListener listener)
      Sets the listener to be notified of e.g. data series changes

      This method is used internally by the library. Usage by the end user will cause unexpected behavior.

      Parameters:
      listener - Listener to add.
    • removeChangeListener

      public void removeChangeListener(ConfigurationChangeListener listener)
      Removes a change listener.
      Parameters:
      listener - Listener to remove.
    • getColorAxis

      public ColorAxis getColorAxis()
      Returns the color axis. This is used in color-based diagrams, like heat maps. In case of multiple axes defined, the first axis is returned. An axis will be created if no axis is defined.
      Returns:
      the color axis.
    • getNumberOfColorAxes

      public int getNumberOfColorAxes()
      Returns:
      the number of color axes defined
    • getColorAxis

      public ColorAxis getColorAxis(int index)
      Returns:
      The Color-axis with the given index or null if the index is not valid
    • removeColorAxes

      public void removeColorAxes()
      Removes all defined color-axes
    • addColorAxis

      public void addColorAxis(ColorAxis axis)
      Adds a color-axis to the configuration
      Parameters:
      axis - The color Axis to add.
      See Also:
    • getLabels

      public List<AnnotationItemLabel> getLabels()
      Returns:
      Labels
      See Also:
    • setLabels

      public void setLabels(AnnotationItemLabel... labels)
      Sets labels that can be positioned anywhere in the chart area
      Parameters:
      labels - The labels to set
    • addLabel

      public void addLabel(AnnotationItemLabel label)
      Adds a single label
      Parameters:
      label - The label to add
      See Also: