Charts Definition Language (CDL): Difference between revisions

From Cumulus Wiki
Jump to navigationJump to search
m
No edit summary
(35 intermediate revisions by the same user not shown)
Line 17: Line 17:
== 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]
   [PLOT [ALL|RECENT] <Plotvariable>  
 
   [ PLOT [ALL|RECENT] <Plotvariable> [ [[CDL - EVAL|EVAL]] '[' <Expression> ']' ]
             AS <Line Type>  
             AS <Line Type>  
             COLOUR <HTML Color>
             COLOUR <HTML Color>
Line 24: Line 25:
             LINEWIDTH <Integer>
             LINEWIDTH <Integer>
             OPACITY <Integer>.<Integer>
             OPACITY <Integer>.<Integer>
            AXIS <Axis Type>
   ]
   ]
  [ [[CDL - STATS|STATS]] <Plotvariable> <Stats Type> ]


   PLOT blocks repeated
   PLOT blocks repeated
  STATS blocks repeated
     [...]
     [...]
   ENDCHART
 
   ENDCHART OUTPUT <filespec>


   CHART […] ENDCHART blocks repeated
   CHART […] ENDCHART blocks repeated


Plot blocks can be repeated as many times as you wish but different parameters can result in many yAxis (making the plot area smaller) and the chart may become crowded and unreadable. Experiment and try-out.
Plot blocks can be repeated as many times as you wish but different parameters can result in many yAxis (making the plot area smaller) and the chart may become crowded and unreadable. Experiment and try-out.
Syntactically the [[CDL - STATS|STATS]] block can be many as well but it requires semantically the Plotvariable of which you want statistics to be plotted normally. So you can have e.g. three [[CDL - STATS|STATS]] blocks for one PLOT block.
=== Output specifier ===
An output file can be specified for each chart by putting ''OUTPUT <filename>'' after an ENDCHART. All charts from that point on will be written to that specified output until a new output is specified for another chart. If no output is specified at all, all charts will be written to ''cumuluscharts.txt'' (the default output)
If you are using the website it is important to know that the first chart will always be used as the chart for the Home page button and that cannot be changed (the file is always ''cumuluscharts.txt''). If, however you specify an output on the first chart, that chart will be duplicated in the output you specify.
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.


=== Keywords ===
=== Keywords ===
All capital written words in the Chart block section are keywords (reserved words) and have meaning.
==== Explanation of the definition Keywords ====
#EQUATIONS: Starts an equations block. Such block only defines (partial) equations, it does not cause code generation in itself
#CHART: Starts a chart definition
#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.
#PLOT: Starts the plot specification using one of the possible variables
#[[CDL - STATS|STATS]]: Starts the statistics block using one of the possible variables. Semantics demands the variable to be plotted normally as well.
#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).
#AS: Defines the type of charting for that variable.
#[[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.
#ZINDEX: Defines the zIndex plane for that variable.
#LINEWIDTH: Defines the linewidth for that variable.
#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.
#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.
The keywords for the actual parameters and the Graph Types speak for themselves.
==== Plotvariables ====
The following PlotVariables are reserved words:
The following PlotVariables are reserved words:


==== With the RECENT qualifier ====
===== With the RECENT qualifier =====
       "InsideTemp", "Dewpoint", "ApparentTemp", "FeelsLike", "WindChill", "HeatIndex","Temperature", "Humidex",
       "InsideTemp", "Dewpoint", "ApparentTemp", "FeelsLike", "WindChill", "HeatIndex","Temperature", "Humidex",
       "WindGust", "WindSpeed",
       "WindGust", "WindSpeed",
Line 47: Line 85:
       "EvapoTranspiration"
       "EvapoTranspiration"


==== With the ALL qualifier ====
===== With the ALL qualifier =====


       "MinTemp", "MaxTemp", "AverageTemp", "WindChill", "MaxDewpoint", "MinDewpoint","MaxFeelsLike", "MinFeelsLike",  
       "MinTemp", "MaxTemp", "AverageTemp", "WindChill", "MaxDewpoint", "MinDewpoint","MaxFeelsLike", "MinFeelsLike",  
Line 57: Line 95:
       "HeatingDegreeDays","CoolingDegreeDays","EvapoTranspiration"
       "HeatingDegreeDays","CoolingDegreeDays","EvapoTranspiration"


=== Graph Types ===
==== Types ====
The following charts are possible and can be combined within a chart except for the Scatter
===== Graph Types =====
       Line, SpLine, Area, Scatter, Column
The following graphs are possible  
      Line, SpLine, Area, Scatter, Column, ColumnRange
 
All graph types can be combined in a chart except for Scatter.
 
ColumnRange only works for DAILY and ALL range specifiers. If the Max and Min lines of the range must be shown, they need to be specified as a separate line. The range can be specified for either Min or Max, the range will automatically be applied and no line will be shown. The ColumnRange is valid for all variables in the datafile with a Max/Min range: ''Temperature, Dewpoint, FeelsLike'' (and other derivatives), ''Barometer'' and ''Humidity''. Other variables will generate an error.
 
===== Axis Types =====
The following Axis are possible.
       Temp, Wind, Distance, Hours, Solar, UV, Rain, Rrate, Pressure, Humidity, DegreeDays, EVT
 
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.
 
===== Other Types =====
For other types such as STATS types (or methods) and FUNCTION types for EVAL, see those respective pages for [[CDL - STATS|STATS]] and for [[CDL - EVAL|EVAL]].
 
=== Equations ===
'''The Equations are in BETA, by the nature of all possible combinations and the recursive parsing not all possible equations have been tested (haha)'''
 
See page [[CDL - EVAL]].
 
== The Chart Axis ==
All PlotVariables have their own defined axis and those axis will be coupled automatically to the chart. Multiple axis will be alternately added left-right where the order in the definition files determines this order. So it is the user who ultimately can define where the axis are places: left or right and from inside to the outside in the order where they are encountered during the parsing process.
 
The following axis are currently defined and implicit for the plot variables (the user has no options here):
#None
#Temp
#Pressure
#Rain
#Rrate
#Wind
#Direction
#Humidity
#Solar
#UV
#Hours
#Distance
#DegreeDays
#EVT
#Free (has no title, unit or context associated with it. It just displays values)
 
Translations for the axis titles come from the [Website] section and should require no additional effort.


== Additional details ==
== Additional details ==
Line 76: Line 157:


== Example CutilsCharts.def ==
== Example CutilsCharts.def ==
The Chart definitions below are a test version operational on meteo-wagenborgen.nl, contains Dutch descriptions and should give you a good impression of the possibilities. As the Ccompiler will develop this code will change.
The Chart definitions below are operational on [https://meteo-wagenborgen.nl meteo-wagenborgen.nl], contains Dutch descriptions and should give you a good impression of the possibilities. As the Compiler will develop this code will change.
 
  Chart Overzicht Title Overzicht van de huidige weerstatus ConnectsTo 2 4 15 20
    PLOT Temperature Colour #058DC7 zindex 90
    PLOT DewPoint Colour #50B432 zindex 80
    PLOT pressure Colour red zindex 70
    Plot Humidity Colour #64E572 zindex 60
    Plot SolarRadiation As Area Opacity 0.2 Colour Orange zindex 20
    Plot RainFall As Area colour #33B4FF opacity 0.2 zindex 10
  EndChart
 
  Chart Temperature Title Temperature and Derivatives ConnectsTo 1 13 14
    Plot InsideTemp As Spline Colour #DDDF00 zIndex 100
    PLOT Temperature As SPline Colour #058DC7 zindex 90
    PLOT FeelsLike As SPline Colour #ED561B zindex 80
    PLOT DewPoint As SPline Colour #50B432 zindex 70
  EndCHART
 
  Chart Wind Title Wind ConnectsTo 5 8
    Plot WindGust
    Plot WindSpeed
  EndCHART
 
  Chart Windrichting Title Windrichting ConnectsTo 6 7
    Plot Bearing As Scatter
    Plot AverageBearing As Scatter
  EndCHART
 
  Chart Regen Title Regen and Regensnelheid ConnectsTo 3 21 22
    Plot RainFall As Area Colour green Opacity 0.2
    Plot RainRate zIndex 100
  EndChart
 
  Chart Vochtigheid Title Relatieve vochtigheid binnen en buiten ConnectsTo 11 16
    Plot Humidity
    Plot InsideHumidity
  EndChart
 
  Chart Zon Title (Max)Straling en UV ConnectsTo 12 23 24
    Plot UV zIndex 100
    Plot SolarRadiation As Area Opacity 0.4 Colour Orange zIndex 50
    Plot TheoreticalSolarMax As Area Colour Gold zIndex 10 Opacity 0.2
  EndChart
 
  CHART DagelijkseTemp TITLE Daily Average Temperature with Min/Max of last year
    PLOT DAILY AverageTemp colour green
    Plot DAILY MinTemp colour blue
    Plot DAILY MaxTemp colour red
  EndChart OUTPUT AllTempChart.txt


Chart Overzicht Title Overzicht van de huidige weerstatus ConnectsTo 2 4 15 20
  Chart DagelijkseRegen Title Daily rainfall of last year
  PLOT Temperature Colour #058DC7 zindex 90
    Plot DAILY RainFall As Column colour lightblue
  PLOT DewPoint Colour #50B432 zindex 80
  EndChart OUTPUT AllRainChart.txt
  PLOT pressure Colour red zindex 70
  Plot Humidity Colour #64E572 zindex 60
  Plot SolarRadiation As Area Opacity 0.2 Colour Orange zindex 20
  Plot RainFall As Area colour #33B4FF opacity 0.2 zindex 10
EndChart


Chart Temperature Title Temperature and Derivatives ConnectsTo 1 13 14
  Chart DagelijkseZonuren Title Sunhours per day of last year
  Plot InsideTemp As Spline Colour #DDDF00 zIndex 100
    Plot ALL SunHours As Column colour gold
  PLOT Temperature As SPline Colour #058DC7 zindex 90
   EndChart OUTPUT AllSolarChart.txt
   PLOT FeelsLike As SPline Colour #ED561B zindex 80
  PLOT DewPoint As SPline Colour #50B432 zindex 70
EndCHART


Chart TempEVT Title Temperature and EVT historical
  Chart TempEVT Title Temperature and EVT historical ConnectsTo 12 23 24
  PLOT ALL AverageTemp As SPline Colour #058DC7 zindex 90 LineWidth 10
  PLOT ALL Evapotranspiration As Column Colour #cc0000
EndCHART


Chart TempEVTRecent Title Temperature and EVT Recently
    PLOT ALL AverageTemp As SPline Colour #058DC7 zindex 90 LineWidth 10
  PLOT Temperature As SPline Colour #058DC7 zindex 90 LineWidth 10
    PLOT ALL Evapotranspiration As Column Colour #cc0000
  PLOT Evapotranspiration As Area Colour #cc0000
  EndCHART OUTPUT RarityCharts.txt
EndCHART


Chart Wind Title Wind ConnectsTo 5 8
  Chart TempEVTRecent Title Temperature and EVT Recently
  Plot WindGust
    PLOT Temperature As SPline Colour #058DC7 zindex 90 LineWidth 10
   Plot WindSpeed
    PLOT Evapotranspiration As Area Colour #cc0000
EndCHART
   EndCHART


Chart Windrichting Title Windrichting ConnectsTo 6 7
  Chart CoolingDays Title Residual variables
  Plot Bearing As Scatter
    Plot ALL CoolingDegreeDays
  Plot AverageBearing As Scatter
    Plot ALL HeatingDegreeDays
EndCHART
    Plot All Evapotranspiration
  EndChart


Chart Regen Title Regen and Regensnelheid ConnectsTo 3 21 22
  CHART DagelijkseTemp TITLE DAILY Temp with ColumnRange
  Plot RainFall As Area Colour green Opacity 0.2
    PLOT DAILY AverageTemp colour green As ColumnRange
   Plot RainRate zIndex 100
    PLOT DAILY AverageTemp colour black As spline
EndChart
   EndChart OUTPUT ColumnRange.txt


Chart Vochtigheid Title Relatieve vochtigheid binnen en buiten ConnectsTo 11 16
  CHART DagelijkseBaro TITLE All Barometer with ColumnRange
  Plot Humidity
    PLOT All MinBarometer colour Crimson As ColumnRange
   Plot InsideHumidity
   EndChart
EndChart


Chart Zon Title (Max)Straling en UV ConnectsTo 12 23 24
  CHART DailyRain TITLE Rain with statistics
  Plot UV zIndex 100
    PLOT ALL RainFall colour CornflowerBlue as column
   Plot SolarRadiation As Area Opacity 0.4 Colour Orange zIndex 50
    PLOT ALL RainFall EVAL [ SUM( RainFall ) ] COLOUR crimson AXIS Free
  Plot TheoreticalSolarMax As Area Colour Gold zIndex 10 Opacity 0.2
    STATS RainFall SMA colour green
EndChart
   EndChart OUTPUT Statistics.txt


CHART DagelijkseTemp TITLE Daily Average Temperature with Min/Max of last year
  CHART DailyTemp TITLE Temp with statistics offset 5
  PLOT DAILY AverageTemp colour green
    PLOT ALL AverageTemp colour pink
  Plot DAILY MinTemp colour blue
    PLOT ALL AverageTemp EVAL [ Sum(AverageTemp-5) ] COLOUR green AXIS DegreeDays
   Plot DAILY MaxTemp colour red
    STATS AverageTemp SMA COLOUR crimson
EndChart
   EndChart


Chart DagelijkseRegen Title Daily rainfall of last year
  Plot DAILY RainFall As Column colour lightblue
EndChart


Chart DagelijkseZonuren Title Sunhours per day of last year
  Plot ALL SunHours As Column colour gold
EndChart


Chart CoolingDays Title Residual variables
[[Category:CumulusUtils]]
  Plot ALL CoolingDegreeDays
  Plot ALL HeatingDegreeDays
  Plot All Evapotranspiration
EndChart

Navigation menu