ods-charts
    Preparing search index...

    Class ODSChartsTheme

    ODSChartsTheme is the object get by ODSCharts.getThemeManager(ODSChartsThemeOptions), refer to ODSChartsTheme.getThemeManager

    This manager is used to

    • get the ODS theme, register it, and use it
    // register this theme to echarts
    echarts.registerTheme(themeManager.name , themeManager.theme);
    // initiate the with the generated theme
    var myChart = echarts.init(div, themeManager.name)
    • to build the graph options
    // Set the data to be displayed.
    themeManager.setDataOptions(<dataOptions>);
    // Register the externalization of the legend.
    themeManager.externalizeLegends(...);
    // Manage chart container size changed
    themeManager.manageChartResize(...);
    // Observe dark / light mode changes
    themeManager.manageThemeObserver(...);
    // Register the externalization of the tooltip/popup
    themeManager.externalizePopover(...);
    // Display the chart using the configured theme and data.
    myChart.setOption(themeManager.getChartOptions());

    See ODSChartsTheme.getThemeManager for details.

    Index

    Properties

    name: string

    Methods

    • manageChartResize() ensures that the graph resizes correctly when its container is resized

      Parameters

      • echart: any

        the initialized eCharts object.

      • chartId: string

        an unique id that identify the chart container in the DOM.

      Returns ODSChartsTheme

      the theme manager object itself to be able to chain calls.

    • manageThemeObserver() is used to enable auto-switch between dark and light mode. It observe the closest element with a data-bs-theme indicator to adapt the graph colour to the new theme.

      Parameters

      • echart: any

        the initialized eCharts object

      Returns ODSChartsTheme

      returns back the theme manager object

    • Set the original Apache Echarts data options of your graph.

      Example:

          lineChartODSTheme
      .setDataOptions({
      xAxis: {
      data: ['shirt', 'cardigan', 'chiffon', 'pants', 'heels', 'socks'],
      },
      series: [
      {
      name: 'sales',
      type: 'bar',
      data: [5, 20, 36, 10, 10, 20],
      },
      ],
      })

      Parameters

      Returns ODSChartsTheme

      the theme manager object