Search code examples
angularag-charts

How to replace empty message?


There is a chart widget. This widget displays text "No visible series" instead of chart when user disable all legend items . I need replace "No visible series" to any text.

To do this i try to add to config the following settings:

  overlays: {
    noData: {
      text: "this is my new text!",
    },
  },

However it doesn't work. Please help me replace this text.

live example is here.

PS: To disable all legend items, you need to click on them all.

This is a config entirely:

{
      title: {
        text: "Browser Usage Statistics",
      },
      subtitle: {
        text: "2009-2019",
      },
      data: getData(),
      overlays: {
        noData: {
          text: "No data to displayzzz",
        },
      },
      series,
      legend,
    };

Solution

  • You can change the translation in two ways.

    1. Via overlay options.
    2. Via locale options.

    First solution:

    {
      title: {
        text: "Browser Usage Statistics",
      },
      subtitle: {
        text: "2009-2019",
      },
      data: getData(),
      overlays: {
        noVisibleSeries: {
          text: "This is my new text!"
        }
      }
      series,
      legend,
    };
    

    Second solution:

    {
      title: {
        text: "Browser Usage Statistics",
      },
      subtitle: {
        text: "2009-2019",
      },
      data: getData(),
      locale: {
        localeText: {
          overlayNoVisibleSeries: "This is my new text!",
        },
      },
      series,
      legend,
    };