ChartsCompiler: Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
Line 3: Line 3:
   |__TOC__
   |__TOC__
   |}
   |}
The ChartsCompiler is the "next-generation" method of creating charts for websites on the basis of CumulusMX based systems. Charts are defined in a dedicated [[Charts Definition Language (CDL)|Charts Definition Language]] and compiled into a file containing both the HTML/javascript menu infrastructure as well as the Highcharts javascript code to create the the charts. Data - JSON files as produced by CumulusMX - is assumed to be present in the directory  from where the page is called.
The ChartsCompiler is the "next-generation" method of creating charts for websites on the basis of CumulusMX based systems. Charts are defined in a dedicated [[Charts Definition Language (CDL)|Charts Definition Language]] and compiled into a file containing both the HTML/javascript menu infrastructure as well as the Highcharts javascript code to create the charts. Data - JSON files as produced by CumulusMX - is assumed to be present in the directory  from where the page is called.


== Operation ==
== Operation ==

Revision as of 10:55, 17 April 2021

Introduction

The ChartsCompiler is the "next-generation" method of creating charts for websites on the basis of CumulusMX based systems. Charts are defined in a dedicated Charts Definition Language and compiled into a file containing both the HTML/javascript menu infrastructure as well as the Highcharts javascript code to create the charts. Data - JSON files as produced by CumulusMX - is assumed to be present in the directory from where the page is called.

Operation

The compiler can be activated/used in two ways: implicit and explicit. Both methods require a file CutilsCharts.def containing the charts definitions to be present in the utils directory.

Implicit activation

If the file CutilsCharts.def with the charts definitions is present in the utils directory then the command:

 utils/bin/cumulusutils.exe Website

will activate the compiler and generate the output.

If the file CutilsCharts.def is not present or contains errors, the output will be the default cumuluscharts.txt, containing the original charts for the Home button in the menu.

Explicit activation

If the file CutilsCharts.def with the charts definitions is present in the utils directory then the command:

 utils/bin/cumulusutils.exe CompileOnly

will activate the compiler explicitly outside the context of the Website Generator. This leads to the possibility to use the output also as a separate module.

Data activation

If the definition of the charts requires additional data not provided by CMX the the following command will automatically provide those data in a JSON in a way similar to CMX.

 utils/bin/cumulusutils.exe UserAskedData


Output

If the file CutilsCharts.def with the charts definitions is present in the utils directory, then the output for the ChartsCompiler is (until version 5.2.0) the file cumuluscharts.txt. As such it replaces the default cumuluscharts.txt which will always be available as a backup in case of errors in the definitions or processing.

Inifile parameters

The module has two inifile parameter (see cumulusutils.ini):

 [Compiler]
 ChartContainerHeight=700       => Provides the means for the  user to adjust the height of the chart which in case of modular use is very usefull (default=700)
 DoneToday=17/04/21             => If the user uses data on Daily basis or All basis (from the dayfile), the data need to be prepared only once per day.
                                   This parameter tells us the age of the data present to the website.


Inner working

The CutilsCharts.def file contains the chart definitions according to the Charts Definition Language.

When the definition is parsed, a list of chart data structures containing all required information is created. After parsing is successful - one pass - the list is passed to the code generator which creates the output.

The user only has influence on the chart definitions. Errors are logged to the standard logfile. There is currently no true error recovery so when an error is encountered it is logged and the compiler exits to fall back to the default cumuluscharts.txt. The user has to correct the error and run the compiler again. A normal way to develop the charts would be to iterate through the command CompileOnly and when the generation goes without errors, incorporate the charts in the website.

Read the Charts Definition Language.