Charts Definition Language (CDL): Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
(33 intermediate revisions by the same user not shown)
Line 10: Line 10:
The text in the ''CutilsCharts.def'' is case independent, however for clarity [https://en.wikipedia.org/wiki/Camel_case CamelCase] or a variety thereof is advised.
The text in the ''CutilsCharts.def'' is case independent, however for clarity [https://en.wikipedia.org/wiki/Camel_case CamelCase] or a variety thereof is advised.


The [[ChartsCompiler]] is obligatory after the introduction of the [[Extra Sensors|ExtraSensors]] module from version 6.5 onwards where the [[ChartsCompiler]] is used internally for defining and creating the charts for the [[Extra Sensors|ExtraSensors]] module which would otherwise - in a generic way - be virtually impossible. The ''CutilsCharts.def'' has a demarcation line which separates the Extra Sensors Charts (below) from the user charts (above). The user can define he wants to create his own Extra Sensor Charts by setting the parameter ''UserModificationExtraSensorCharts=true''.
The [[ChartsCompiler]] is obligatory after the introduction of the [[Extra Sensors|ExtraSensors]] module from version 6.5 onwards where the [[ChartsCompiler]] is used internally for defining and creating the charts for the [[Extra Sensors|ExtraSensors]] module which would otherwise - in a generic way - be virtually impossible. The ''CutilsCharts.def'' has a demarcation line which separates the Extra Sensors Charts (below) from the user charts (above). The user may want to create his own Extra Sensor Charts and he can do so by setting the parameter ''UserModificationExtraSensorCharts=true'', if he does so existing [[Extra Sensors]] charts in the ''CutilsCharts.def'' file remain untouched.


A standard CutilsCharts.def and a CutilsCharts-example.def are in the distribution. The first for an initial setup, the second to guide the user into the possibilities.
A standard ''CutilsCharts.def'' and a ''CutilsCharts-example.def'' can be found in the distribution. The first for an initial minimum setup, the second to guide the user into the possibilities.


== The specification ==
== The specification ==
[[File:ChartCompilerSpec2.jpg|upright|1300px|left|Chart Compiler Language (CDL) specification ]]
[[File:ChartCompilerSpec.jpeg|upright|1300px|left|Chart Compiler Language (CDL) specification ]]
<br clear=all>
<br clear=all>


== The Language ==
== The Language ==
=== The Chart block ===
=== The Chart block ===
   CHART <id> TITLE [<word>...<word>]  CONNECTSto [1 … 24]
   CHART <id> TITLE [<word>...<word>]   
    CONNECTSto [1 … 24]
    HAS WINDBARBS [ ABOVE | BELOW ]
    ZOOM <Integer>


  [ PLOT [ALL||DAILY|RECENT|EXTRA] <Plotvariable> [ [[CDL - EVAL|EVAL]] '[' <Expression> ']' ]
    [ PLOT [ALL||DAILY|RECENT|EXTRA] <Plotvariable> [ [[CDL - EVAL|EVAL]] '[' <Expression> ']' ]  ]
  | [ [[CDL - STATS|STATS]] [ALL||DAILY|RECENT|EXTRA] <Plotvariable> <Stats Type> ]
             AS <Line Type>  
             AS <Line Type>  
             COLOUR <HTML Color>
             COLOUR <HTML Color>
Line 29: Line 33:
             OPACITY <Integer>.<Integer>
             OPACITY <Integer>.<Integer>
             AXIS <Axis Type>
             AXIS <Axis Type>
  ]
  [ [[CDL - STATS|STATS]] <Plotvariable> <Stats Type> ]


   PLOT blocks repeated
   PLOT blocks repeated
Line 50: Line 52:


The output specifier gives the user the possibility to define charts as he likes and to place these in the menu wherever he likes. In the [[Website Generator]] the placements of the charts at the moment will be limited to the [[User Defined Menu]]. In modular use the user can do whatever he likes with the resulting files. In the website the charts require the datafiles to be in the current directory.
The output specifier gives the user the possibility to define charts as he likes and to place these in the menu wherever he likes. In the [[Website Generator]] the placements of the charts at the moment will be limited to the [[User Defined Menu]]. In modular use the user can do whatever he likes with the resulting files. In the website the charts require the datafiles to be in the current directory.
=== Info specifier ===
A free helptext can be specified after the chart using this keyword:
  INFO " This is a free HTMLformat helptext which can contain an axplanation of the chart "
The double quotes around the helptext are obligatory and must be enclosed by spaces.


=== Keywords ===
=== Keywords ===
Line 55: Line 62:


==== Explanation of the definition Keywords ====
==== Explanation of the definition Keywords ====
#EQUATIONS: Starts an equations block. Such block only defines (partial) equations, it does not cause code generation in itself
#EQUATIONS (Optional construct): Starts an equations block. Such block only defines (partial) equations, it does not cause code generation in itself
#CHART: Starts a chart definition
#CHART: Starts a chart definition
#TITLE: Starts the title. All words until the next keyword comprise the title of the chart
#TITLE: Starts the title. All words until the next keyword comprise the title of the chart
#CONNECTSTO: The integer numbers which follow CONNECTSTO represent a pane in the realtime [[Dashboard|dashboard]]. When clicked on that pane this chart appears. This is only valid on charts in the default output. For other outputs there is no semantics for CONNECTSTO and a warning is issued in the logfile if it is specified in any second or higher output.
#CONNECTSTO (Optional construct): The integer numbers which follow CONNECTSTO represent a pane in the realtime [[Dashboard|dashboard]]. When clicked on that pane this chart appears. This is only valid on charts in the default output. For other outputs there is no semantics for CONNECTSTO and a warning is issued in the logfile if it is specified in any second or higher output.
#PLOT: Starts the plot specification using one of the possible variables
#HAS WINDBARBS [ ABOVE | BELOW ] (Optional construct): Defines if the chart displays the WINDBARBS showing direction and speed as indicators (this is not an exact plot of wind). Above | Below specifies the place in the chart.
#ZOOM (Optional construct): Indicates which range selector button is the default when the chart is displayed; Defaults depend on chart range.
#PLOT: Starts the plot specification using one of the possible variables. Each chart requires at least one PLOT.
#[[CDL - STATS|STATS]]: Starts the statistics block using one of the possible variables. Semantics demands the variable to be plotted normally as well.
#[[CDL - STATS|STATS]]: Starts the statistics block using one of the possible variables. Semantics demands the variable to be plotted normally as well.
#RECENT: Defines the variable to be governed by the CMX parameter ''GraphHours'' and are similar to the CMX RECENT graphs (though not equal).
#ALL: Defines the variable to be taken from the [[Dayfile.txt|Dayfile]] and all data for that variable will be plotted (Note that the CMX parameter ''ChartMaxDays'' will not be used)
#ALL: Defines the variable to be taken from the [[Dayfile.txt|Dayfile]] and all data for that variable will be plotted (Note that the CMX parameter ''ChartMaxDays'' will not be used)
#RECENT: Defines the variable to be governed by the CMX parameter ''GraphHours'' and are similar to the CMX RECENT graphs (though not equal).
#DAILY: Identical to the ALL keyword but it sets the datarange for the chart to one month while the ALL keyword sets it to one year.
#AS: Defines the type of charting for that variable.
#EXTRA: Defines the variable to be an extra sensor variable. It has an implicit datarange of RECENT.
#AS (Optional construct): Defines the type of charting for that variable. All attributes of AS are optional.
#[[CDL - EVAL|EVAL]] [ ]: Defines an expression for the plot variable. The equation must be placed between the square brackets, space has no value here (does not act as separator).
#[[CDL - EVAL|EVAL]] [ ]: Defines an expression for the plot variable. The equation must be placed between the square brackets, space has no value here (does not act as separator).
#COLOUR: Defines the colour of that variable.
#COLOUR: Defines the colour of that variable.
#ZINDEX: Defines the zIndex plane for that variable.
#ZINDEX: Defines the zIndex plane for that variable.
#LINEWIDTH: Defines the linewidth for that variable.
#LINEWIDTH: Defines the linewidth for that variable. When the chart type is ''scatter'', this attribute defines the radius of the points.
#OPACITY: Defines the opacity for that variable (important for area and column graphs)
#OPACITY: Defines the opacity for that variable (important for area and column graphs)
#AXIS: Gives the user the possibility to specify an axis when using the EVAL construct otherwise an error is generated.
#AXIS: Gives the user the possibility to specify an axis when using the EVAL construct otherwise an error is generated.
#ENDCHART: End the chart definition
#ENDCHART: End the chart definition
#OUTPUT: Gives an optional name of an outputfile which starts at the chart where it is defined. Any chart after this OUTPUT specifier goes to this OUTPUT until another OUTPUT is found. Only the first OUTPUT specifier accepts click events as defined by CONNECTSTO.
#OUTPUT (Optional construct): Gives an optional name of an outputfile which starts at the chart where it is defined. Any chart after this OUTPUT specifier goes to this OUTPUT until another OUTPUT is found. Only the first OUTPUT specifier (implicitly: cumuluscharts.txt) accepts click events as defined by CONNECTSTO.  
#INFO (Optional construct): Introduces a helptext section for the chart. The free text is enclosed in double quotes and cannot contain double quotes. The double quotes are delimited by a space character.
 


The keywords for the actual parameters and the Graph Types speak for themselves.
The keywords for the actual parameters and the Graph Types speak for themselves.
Line 82: Line 95:
       "WindGust", "WindSpeed",
       "WindGust", "WindSpeed",
       "Bearing", "AverageBearing",
       "Bearing", "AverageBearing",
       "UV", "SolarRadiation", "TheoreticalSolarMax",
       "UV", "CurrentSolarRad", "TheoreticalSolarMax",
       "RainFall", "RainRate",
       "RainFall", "RainRate",
       "Pressure",
       "Pressure",
       "Humidity", "InsideHumidity",
       "Humidity", "InsideHumidity",
       "EvapoTranspiration"
       "EvapoTranspiration"
NOTE: The RECENT qualifier is optional as it is the default for a chart.<br/>
NOTE: The zoom buttons for the RECENT chart <math>1/4</math> and <math>1/2</math> the value of the hours specified in the CMX parameter ''GraphHours''.


===== With the ALL/DAILY qualifier =====
===== With the ALL/DAILY qualifier =====


       "MinTemp", "MaxTemp", "AverageTemp", "WindChill", "MaxDewpoint", "MinDewpoint","MaxFeelsLike", "MinFeelsLike",  
       "MinTemp", "MaxTemp", "AverageTemp", "AvgWindChill", "MaxDewpoint", "MinDewpoint","MaxFeelsLike", "MinFeelsLike",  
       "MaxGust", "WindRun", "WindSpeed",  
       "MaxGust", "WindRun", "HighAvgWindSpeed",  
       "UV-Index", "SolarRadiation", "SunHours",
       "UV-Index", "SolarRadiation", "SunHours",
       "RainFall", "MaxRainRate",
       "DayRain", "MaxRainRate",
       "MinBarometer", "MaxBarometer",
       "MinBarometer", "MaxBarometer",
       "MinHumidity", "MaxHumidity",
       "MinHumidity", "MaxHumidity",
       "HeatingDegreeDays","CoolingDegreeDays","EvapoTranspiration"
       "HeatingDegreeDays","CoolingDegreeDays","DayEVT"


Note: The difference between ALL and DAILY is only between the displayed datarange (6 months or 1 month)
Note: The difference between ALL and DAILY is only between the displayed datarange (6 months or 1 month)
Line 128: Line 144:
===== Axis Types =====
===== Axis Types =====
The following Axis are possible.  
The following Axis are possible.  
       Temp, Wind, Distance, Hours, Solar, UV, Rain, Rrate, Pressure, Humidity, DegreeDays, EVT, AQ, ppm
       Temp, Wind, Distance, Hours, Solar, UV, Rain, Rrate, Pressure, Humidity, DegreeDays, EVT, AQ, ppm, Free


This only has meaning if there is an [[CDL - EVAL|EVAL]] with a valid expression present. As an [[CDL - EVAL|EVAL]] may modify the value of the plot variable to something completely different, the original Axis belonging to that plot variable may be useless or scale wrongly. Therefore you can choose your own Axis. If there is no valid equation, a warning is given and no axis is generated.
This only has meaning if there is an [[CDL - EVAL|EVAL]] with a valid expression present. As an [[CDL - EVAL|EVAL]] may modify the value of the plot variable to something completely different, the original Axis belonging to that plot variable may be useless or scale wrongly. Therefore you can choose your own Axis. If there is no valid equation, a warning is given and no axis is generated.


In future a generic (without title or unit) Axis will selectable to accommodate plotting in combination with other variables.
A generic (without title or unit) Axis is selectable to accommodate plotting in combination with other variables, this is the ''Free'' axis type.


===== Other Types =====
===== Other Types =====
Line 163: Line 179:
#ppm
#ppm


Translations for the axis titles come from the [Website] section and should require no additional effort.
Translations for the axis titles come from the [Website] section (until '''''EVT''''') and should require no additional effort.
Subsequent translations of axis titles come from the [Compiler] section (from '''''Free''''' onwards) and may require translation.


== Additional details ==
== Additional details ==
#All parameters can be combined in one graph with the corresponding axis automatically added. Only when scatter is defined as Line Type it is forbidden to combine it with one of the other possibilities. This may change in future.
#All parameters can be combined in one graph with the corresponding axis automatically added. <s>Only when scatter is defined as Line Type it is forbidden to combine it with one of the other possibilities. This may change in future.</s> The scatter combination with other charts types is now available but may be subject to change.
#The Legend texts are implemented as translations of the PlotKeywords (the Plot Variables). You will find these in the translation file section [Compiler]. Legend entries can be multiple words (the keywords can not).
#The Legend texts are implemented as translations of the PlotKeywords (the Plot Variables). You will find these in the translation file section [Compiler]. Legend entries can be multiple words (the keywords can not).
#The width of the graph container is 100% of the viewport.  
#The width of the graph container is 100% of the viewport.  
#The height of the graph container can be specified in the options (not defined in the language to prevent overcharge):
#The height of the graph container can be specified in the inifile parameters (not defined in the language to prevent overcharge):
   [Compiler]
   [General]
   ChartContainerHeight=650 (Default)
   ChartContainerHeight=650 (Default)
#The Plot Variables Evapotranspiration, CoolingDegreeDays and Heating DegreeDays are not supplied by CMX in the JSONs. CumulusUtils provides those automatically when used in the definitions (on request) with the commandline parameter [[UserAskedData]]. See also [[ChartsCompiler#Operation|ChartsCompiler Operation]].
#The Plot Variables Evapotranspiration, CoolingDegreeDays and Heating DegreeDays are not supplied by CMX in the JSONs. CumulusUtils provides those automatically when used in the definitions (on request) with the commandline parameter [[UserAskedData]].  
#You have to schedule this command if you wish to use the FTP frequency CMX uses for its JSON's. Note that these JSON files specific to CumulusUtils '''always reside in the website root''' of CumulusUtils, even if you have more websites and define the ''CumulusRealTimeLocation''.
#All Extra Sensor Plotvariables are supplied by CumulusUtils through the commandline parameter [[UserAskedData]].
#For the commandline parameter [[UserAskedData]]: see also [[ChartsCompiler#Operation|ChartsCompiler Operation]].  
#You have to schedule [[UserAskedData]] command if you wish to use the FTP frequency CMX uses for its JSON's. Note that these JSON files specific to CumulusUtils '''always reside in the website root''' of CumulusUtils, even if you have more websites and define the ''CumulusRealTimeLocation''.
#If the  user uses different locales for CMX and CumulusUtils the monthly log filenames will be according to the locale of CMX. This creates an issue which is solved by the inifile parameter:
#If the  user uses different locales for CMX and CumulusUtils the monthly log filenames will be according to the locale of CMX. This creates an issue which is solved by the inifile parameter:
   [General]
   [General]
Line 182: Line 201:
The Chart definitions below is included in the distribution of CumulusUtils and serves as an example.
The Chart definitions below is included in the distribution of CumulusUtils and serves as an example.


<pre style="height: 700px; overflow:scroll; width:auto;" >
;
;
; ChartsCompiler Demo and test chart definitions - Part of CumulusUtils
; ChartsCompiler Demo and test chart definitions - Part of CumulusUtils
Line 207: Line 227:


; Do the WindChill According to https://sciencing.com/relative-humidity-7611453.html / CMX
; Do the WindChill According to https://sciencing.com/relative-humidity-7611453.html / CMX
; Note the eqn is only valid for degr Celsius and Kmh.
; Note: the eqn is only valid for degr Celsius and Kmh.
; See https://sciencing.com/relative-humidity-7611453.html for imperial formula.
; See https://sciencing.com/relative-humidity-7611453.html for imperial formula.
;  WindPOW Eval [ pow(WindSpeed, 0.16) ]
;  WindPOW Eval [ pow(WindSpeed, 0.16) ]
Line 220: Line 240:


Chart Overzicht Title Overzicht van de huidige weerstatus ConnectsTo 2 4 15 20
Chart Overzicht Title Overzicht van de huidige weerstatus ConnectsTo 2 4 15 20
Has WindBarbs Above
   PLOT Temperature Colour #058DC7 zindex 90
   PLOT Temperature Colour #058DC7 zindex 90
   PLOT DewPoint Colour #50B432 zindex 80
   PLOT DewPoint Colour #50B432 zindex 80
Line 256: Line 277:


Chart Zon Title (Max)Straling en UV ConnectsTo 12 23 24
Chart Zon Title (Max)Straling en UV ConnectsTo 12 23 24
   Plot UV zIndex 100
   Plot UV zIndex 100
   Plot SolarRadiation As Area Opacity 0.4 Colour Orange zIndex 50  
   Plot SolarRadiation As Area Opacity 0.4 Colour Orange zIndex 50  
   Plot TheoreticalSolarMax As Area Colour Gold zIndex 10 Opacity 0.2
   Plot TheoreticalSolarMax As Area Colour Gold zIndex 10 Opacity 0.2
EndChart
EndChart


Line 328: Line 349:
; https://iridl.ldeo.columbia.edu/dochelp/QA/Basic/dewpoint.html
; https://iridl.ldeo.columbia.edu/dochelp/QA/Basic/dewpoint.html
;
;
; Compare the Dewpoint from Cumulus with the calculated approximation
; Compare the Dewpoint from Cumulus with the caclculated approximation
; Later I will enter the Cumulus Calculation and have the Humidity be produced by the Davis station
; Later I will enter the Cumulus Calculation and have the Humidity be produced by the Davis station
; Nice comparison
; Nice comparison
Line 364: Line 385:
   Plot RECENT pwsFWI Eval [ Psat2008 * (1 - Humidity/100)*WindSpeed ] As spline Axis Free Colour Red
   Plot RECENT pwsFWI Eval [ Psat2008 * (1 - Humidity/100)*WindSpeed ] As spline Axis Free Colour Red
EndChart
EndChart
</pre>


[[Category:CumulusUtils]]
[[Category:CumulusUtils]]

Navigation menu