Skip to content

Advanced chart options

Rello edited this page Jul 30, 2024 · 9 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.

Advanced chart options can be entered in the report definition below the chart type

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:

  • 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}}}

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