Skip to content

Advanced chart options

Rello edited this page Nov 18, 2024 · 10 revisions

Analytics is using a predefined set of chart options to work with most use cases and devices.
If specific optimizations are required, the chart can be manipulated on report level.

  • Chart options can be entered to change settings like axis parameters
  • Data options can be entered to change settings like data series colors

Screenshot 2020-04-01 at 23 19 47

The format needs to match the chartjs api. e.g.: https://www.chartjs.org/docs/latest/axes/cartesian/time.html

Examples from user questions (chart options):

  • change the x-axis to write months and not days
    {"scales": {"x": {"time": {"unit" : "month"}}}}

  • Input data just has day/month like "12.03" and missing year
    {"scales": {"x": {"time": {"parser" : "DD.MM"}}}}

  • Input data is based on unix timestamp
    {"scales": {"x": {"time": {"parser" : "X"}}}}

  • change the standard y-axis by using "primary"
    {"scales": {"primary":{"min": -10, "max": 40}}}

Examples from user questions (data options):

  • remove the area color for a chart with only one line
    {"0": {"fill":"false"}}

Debugging

Getting advanced parameters correct can be challenging with the chartjs api. To support analysis and debugging, you can access the generated chart object by using the following in the browser console OCA.Analytics.chartObject