Defining New Charts - bellrichm/weewx-jas GitHub Wiki

Defining New Charts

WeeWX uses Apache ECharts to generate the charts. A very complete set of reference documentation exists. WeeWX-JAS also contains some basic charts. To see the predefined charts, browse the [chart_definitions](/bellrichm/weewx-jas/wiki/chart_definitions) section of skin.conf. Each section under [[chart_definitions](/bellrichm/weewx-jas/wiki/[chart_definitions) is a separate chart.

With the exception of series and weewx, options map directly to EChart configuration options. Specifically, objects {} in the EChart configuration map to sections [] in the weewx.conf. So if you wanted to configure the title for the chart, the EChart configuration would look like this.

var option = {
  title: {
    left: 'center',
    text: 'Inside Temperature',
  }}

And the weewx.conf would look like this.

[[[chart_definitions](/bellrichm/weewx-jas/wiki/[[chart_definitions)]]
    [[[[inTempChart](/bellrichm/weewx-jas/wiki/[[[inTempChart)]]]
        [[[[[title](/bellrichm/weewx-jas/wiki/[[[[title)]]]]
            left = "'center'"
            text = "'Inside Temperature'"

[[[chart_definitions](/bellrichm/weewx-jas/wiki/[[chart_definitions)]]

This section is used to define the additional charts.

[[[[chart-name](/bellrichm/weewx-jas/wiki/[[[chart-name)]]]

Each additional chart gets it is own section. The section is the name of the chart. The additional charts can then be included on any page.

EChart Options

Any valid EChart option and sub-option(s).

[[[[[weewx](/bellrichm/weewx-jas/wiki/[[[[weewx)]]]]

The weewx section is for options that are used by WeeWX-JAS.

data_binding =

Sets the WeeWX data_binding for this chart.

title =

Sets the title for this chart. If not set, the variable ’chart-name’_title in the lang files can be used to set the title.

[[[[[[yAxis](/bellrichm/weewx-jas/wiki/[[[[[yAxis)]]]]]

Used to specify optons specific to the y-axis.

Any valid yAxis option and sub-option(s).

[[[[[series](/bellrichm/weewx-jas/wiki/[[[[series)]]]]

The [[[[[series](/bellrichm/weewx-jas/wiki/[[[[series)]]]] option can have N subsections. Each subsection is a WeeWX observation to be plotted. WeeWX-JAS will create the name and data options for each series.

[[[[[[observation-name](/bellrichm/weewx-jas/wiki/[[[[[observation-name)]]]]]

EChart Options =

Any valid series option and sub-option(s).

[[[[[[[weewx](/bellrichm/weewx-jas/wiki/[[[[[[weewx)]]]]]]

The weewx section is for options that are used by WeeWX-JAS.

data_binding =

Sets the WeeWX data_binding for this observation .

aggregate_type =

Sets the WeeWX aggregate_type for this observation.

unit =

Sets the WeeWX unit for this observation.

Putting it all together, the WeeWX configuration would look like this.

[StdReport]
    [jas](/bellrichm/weewx-jas/wiki/jas)
        [[Extras](/bellrichm/weewx-jas/wiki/[Extras)]
            [[[chart_definitions](/bellrichm/weewx-jas/wiki/[[chart_definitions)]]
                [[[[outHumidity](/bellrichm/weewx-jas/wiki/[[[outHumidity)]]]
                    [[[[[title](/bellrichm/weewx-jas/wiki/[[[[title)]]]]
                        left = "'center'"
                        text = "'Outside Humidity'"
                [[[[[weewx](/bellrichm/weewx-jas/wiki/[[[[weewx)]]]]
                    data_binding = wx_view 
                [[[[[series](/bellrichm/weewx-jas/wiki/[[[[series)]]]]
                    [[[[[[dewpoint](/bellrichm/weewx-jas/wiki/[[[[[dewpoint)]]]]]
                        yAxisIndex = 0
                        type = "'line'"
                        smooth = true
                        symbol = "'none'"                    
                        [[[[[[[label](/bellrichm/weewx-jas/wiki/[[[[[[label)]]]]]]
                            show = true
                            fontSize = 20
                        [[[[[[[weewx](/bellrichm/weewx-jas/wiki/[[[[[[weewx)]]]]]]
                            data_binding = data_binding02    
                    [[[[[[outHumidity](/bellrichm/weewx-jas/wiki/[[[[[outHumidity)]]]]]
                        yAxisIndex = 1
                        type = "'scatter'"
                        symbolSize = 5
                        [[[[[[[label](/bellrichm/weewx-jas/wiki/[[[[[[label)]]]]]]
                            show = true
                            fontSize = 20

Or using WeeWX-JAS defaults, a simple line chart of inTemp and outTemp would like lthis.

[StdReport]
    [jas](/bellrichm/weewx-jas/wiki/jas)
        [[Extras](/bellrichm/weewx-jas/wiki/[Extras)]
            [[chart_definitions](/bellrichm/weewx-jas/wiki/[chart_definitions)]]
                [[[[TempChart](/bellrichm/weewx-jas/wiki/[[[TempChart)]]]
                    [[[[[series](/bellrichm/weewx-jas/wiki/[[[[series)]]]]
                        [[[[[[inTemp](/bellrichm/weewx-jas/wiki/[[[[[inTemp)]]]]]
                        [[[[[[outTemp](/bellrichm/weewx-jas/wiki/[[[[[outTemp)]]]]]