Code Monkey home page Code Monkey logo

weewx-highcharts's Introduction

Highcharts for WeeWX extension

Description

The Highcharts for WeeWX extension provides a JSON data feed to support weekly and yearly observation plots using Highcharts. A sample HTML page and the JavaScript necessary to render the Highcharts plots is also included in the Highcharts for WeeWX repositry.

The Highcharts for WeeWX extension consists of a skin generating two reports, a number of Search List Extensions (SLE) and supporting JavaScript.

Pre-Requisites

The Highcharts for WeeWX extension requires WeeWX v3.4.0 or greater. The display of the Highcharts for WeeWX extension data on a web page using the included Javascript files requires the Highcharts Highstock charting tool and the JQuery JavaScript library.

Installation

The preferred method to install the Highcharts for WeeWX extension is to use the WeeWX wee_extension utility. To install the Highcharts for WeeWX extension using the WeeWX wee_extension utility:

Note: Symbolic names are used below to refer to some file location on the WeeWX system. These symbolic names allow a common name to be used to refer to a directory that may be different from system to system. The following symbolic names are used below:

$HTML_ROOT. The path to the directory where WeeWX generated reports are saved. This directory is normally set in the [StdReport] section of weewx.conf. Refer to where to find things in the WeeWX User's Guide for further information.

  1. Download the latest Highcharts for WeeWX extension from the Highcharts for WeeWX releases page into a directory accessible from the WeeWX machine.

    $ wget -P /var/tmp https://github.com/gjr80/weewx-highcharts/releases/download/v0.3.2/hfw-0.3.2.tar.gz
    
  2. Install the Highcharts for WeeWX extension downloaded at step 1 using the wee_extension utility:

    $ wee_extension --install=/var/tmp/hfw-0.3.2.tar.gz
    

    Note: Depending on your system/installation the above command may need to be prefixed with sudo.

    This will result in output similar to the following:

    Request to install '/var/tmp/hfw-0.3.2.tar.gz'
    Extracting from tar archive /var/tmp/hfw-0.3.2.tar.gz
    Saving installer file to /home/weewx/bin/user/installer/Hfw
    Saved configuration dictionary. Backup copy at /home/weewx/weewx.conf.20200923124410
    Finished installing extension '/var/tmp/hfw-0.3.2.tar.gz'
    
  3. Restart WeeWX:

    $ sudo /etc/init.d/weewx restart
    

    or

    $ sudo service weewx restart
    

    or

    $ sudo systemctl restart weewx
    

This will result in the Highcharts for WeeWX JSON data files being generated during each report generation cycle. A default installation will result in the generated JSON data files being placed in the $HTML_ROOT/json directory. The Highcharts for WeeWX installation can be further customized (eg units of measure, file locations etc) by referring to the Highcharts for WeeWX wiki.

Support

General support issues may be raised in the Google Groups weewx-user forum. Specific bugs in the Highcharts for WeeWX extension code should be the subject of a new issue raised via the Issues Page.

Licensing

The Highcharts for WeeWX extension is licensed under the GNU Public License v3.

weewx-highcharts's People

Contributors

gjr80 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

weewx-highcharts's Issues

dependencies to weewxwd?

not 100% researched and not longer testet -just for info... It looks like hfw has some dependencies on weewxwd, I don't reall see a need in them...

cheetahgenerator: Generated 14 files for report StandardReport in 37.90 seconds imagegenerator: Generated 12 images for StandardReport in 5.10 seconds copygenerator: copied 9 files to /var/www/weewx reportengine: Caught unrecoverable exception in generator weewx.cheetahgenerator.CheetahGenerator **** Unknown data binding ''wd_binding'' **** Traceback (most recent call last): **** File "/usr/share/weewx/weewx/reportengine.py", line 239, <snip>

so I installed wee_extension --install=./weewxwd-1.0.3.tar.gz:
cheetahgenerator: Generated 14 files for report StandardReport in 37.49 seconds imagegenerator: Generated 12 images for StandardReport in 5.13 seconds copygenerator: copied 9 files to /var/www/weewx reportengine: Caught unrecoverable exception in generator weewx.cheetahgenerator.Che etahGenerator **** unsupported operand type(s) for /: 'NoneType' and 'float' **** Traceback (most recent call last): **** File "/usr/share/weewx/weewx/reportengine.py", line 239, in run <snip>

happens on weewx out of the box v3.7.1 and 3.6.2 (dep's) with mysql backend

I wasn't successful to generate json - I ended up with a simple simple php script.

wee_extension --install fails

If I retrieve the latest weewx-highcharts (for python3) as follows:
wget https://github.com/gjr80/weewx-highcharts/archive/python3.zip -O /tmp/hfw.zip

Then install with wee_extension as follows:
wee_extension --install=/tmp/hfw.zip
I get the following error:

Traceback (most recent call last):
  File "/usr/share/weewx/wee_extension", line 88, in <module>
    main()
  File "/usr/share/weewx/wee_extension", line 80, in main
    ext.install_extension(options.install)
  File "/usr/share/weewx/weecfg/extension.py", line 123, in install_extension
    self.install_from_dir(extension_dir)
  File "/usr/share/weewx/weecfg/extension.py", line 181, in install_from_dir
    shutil.copy(source_path, destination_path)
  File "/usr/lib/python3.7/shutil.py", line 245, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/var/tmp/weewx-highcharts-python3/bin/user/highchartsSearchX.py'

To fix I changed in file install.py, line 171 to read as follows:
files=[('bin/user', ['bin/user/highchartssearchlist.py']

wee_reports crashes with "TypeError: '>' not supported between instances of 'NoneType' and 'float'" (fixed)

When running wee_reports I get this error:
(This is with latest "official" release, ie 0.3.0):

$ wee_reports
Using configuration file /etc/weewx/weewx.conf
Generating for all time
Traceback (most recent call last):
  File "/usr/share/weewx/weewx/reportengine.py", line 196, in run
    obj.start()
  File "/usr/share/weewx/weewx/reportengine.py", line 281, in start
    self.run()
  File "/usr/share/weewx/weewx/cheetahgenerator.py", line 149, in run
    ngen = self.generate(gen_dict[section_name], self.gen_ts)
  File "/usr/share/weewx/weewx/cheetahgenerator.py", line 219, in generate
    ngen += self.generate(section[subsection], gen_ts)
  File "/usr/share/weewx/weewx/cheetahgenerator.py", line 219, in generate
    ngen += self.generate(section[subsection], gen_ts)
  File "/usr/share/weewx/weewx/cheetahgenerator.py", line 308, in generate
    default_binding)
  File "/usr/share/weewx/weewx/cheetahgenerator.py", line 379, in _getSearchList
    searchList += obj.get_extension_list(timespan, db_lookup)
  File "/usr/share/weewx/user/highchartssearchlist.py", line 1243, in get_extension_list
    period)
  File "/usr/share/weewx/user/highchartssearchlist.py", line 961, in calc_windrose
    max_speed = max(speed_vec_vt.value)
TypeError: '>' not supported between instances of 'NoneType' and 'float'
$

After fixing this on my own I noticed this has already been officially fixed.
Gary, would you agree to release 0.3.1 please ? so we can just download it as latest and not run into this "bug".
Many thanks in advance.
Gabriel.

DatePicker

Hi Gary,
I have added a jquery datepicker to plots.js to use on a range selector in the weewx highcharts extension. Do you want me to send it to you? It is only 4 lines in plots.js and two lines in the parent page to load the javascript and css.
Thanks Jerry

Error Message

seems that are some problems on my system

get this here:

Jun 23 09:45:42 localhost weewx[6094]: cheetahgenerator: **** Ignoring template /etc/weewx/skins/Highcharts/json/week.json.tmpl
Jun 23 09:45:42 localhost weewx[6094]: cheetahgenerator: **** Reason: cannot find 'wr86400'
Jun 23 09:45:42 localhost weewx[6094]: **** Traceback (most recent call last):
Jun 23 09:45:42 localhost weewx[6094]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 332, in generate
Jun 23 09:45:42 localhost weewx[6094]: **** fd.write(str(compiled_template))
Jun 23 09:45:42 localhost weewx[6094]: **** File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in str
Jun 23 09:45:42 localhost weewx[6094]: **** rc = getattr(self, mainMethName)()
Jun 23 09:45:42 localhost weewx[6094]: **** File "_etc_weewx_skins_Highcharts_json_week_json_tmpl.py", line 346, in respond
Jun 23 09:45:42 localhost weewx[6094]: **** NotFound: cannot find 'wr86400'
Jun 23 09:45:44 localhost weewx[6094]: cheetahgenerator: Generate failed with exception '<class 'NameMapper.NotFound'>'
Jun 23 09:45:44 localhost weewx[6094]: cheetahgenerator: **** Ignoring template /etc/weewx/skins/Highcharts/json/year.json.tmpl
Jun 23 09:45:44 localhost weewx[6094]: cheetahgenerator: **** Reason: cannot find 'wrmonth'
Jun 23 09:45:44 localhost weewx[6094]: **** Traceback (most recent call last):
Jun 23 09:45:44 localhost weewx[6094]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 332, in generate
Jun 23 09:45:44 localhost weewx[6094]: **** fd.write(str(compiled_template))
Jun 23 09:45:44 localhost weewx[6094]: **** File "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in str
Jun 23 09:45:44 localhost weewx[6094]: **** rc = getattr(self, mainMethName)()
Jun 23 09:45:44 localhost weewx[6094]: **** File "_etc_weewx_skins_Highcharts_json_year_json_tmpl.py", line 338, in respond
Jun 23 09:45:44 localhost weewx[6094]: **** NotFound: cannot find 'wrmonth'
Jun 23 09:45:44 localhost weewx[6094]: cheetahgenerator: Generated 0 files for report Highcharts in 4.23 seconds
Jun 23 09:46:14 localhost weewx[6094]: ftpgenerator: ftp'd 116 files in 30.07 seconds

Suggestion/proposal :Provide demo ? (website site or standalone)

Hello !

It would be great to share either a link to a demo website, or maybe provide some samples of week.json and year.json so we can see a demo ?

currently, as far as I understand, we must first install everything to output some json files before running the provided graphs.html.

This is just a kind suggestion, I'm not sure where to put this else than here. Sorry if it's not suitable!

Best regards,

Day and Month SLE/skin missing?

Hey there, I've been using the highcharts extension for a couple of years now, thanks again for the help early on setting it up.

I'm working on releasing a weewx skin that's a clone of my weather site, and it uses the highcharts extension as an optional dependency. Preparing for that dependancy though I installed the extension fresh on my lab system and saw that the day and month SLE and skin files were gone. Were those removed on purpose or an oversight?

In the version of highchartsSearchX.py that I have, they are there and I can't recall if that was original to your code or if I added them long ago?

Anyways - wanted to check in to see if they should be added as they do have value.

Implement a unit of measure independent means of specifying minimum y-axis ranges

For an observation that only varies by a small amount over the period displayed on a Highcharts plot (eg 997-999 hPa for barometric pressure ie a 2hPa spread) Highcharts will autoscale the y-axis range. For our 2hPa example this could result in y-axis range of say 996 to 1000 hPa making our very small variation appear large (50% of the y-axis range). This could be solved by specifying a minRange value for the y-axis, that way autoscaling will only kick in if the minRange is exceeded. This is already the case with rainfall where minRange of 5 is specified. The problem with this is that a minRange of 5 for rainfall would be interpreted as 5mm in a metric system and 5in in an imperial system. Not really workable. If there was a mechanism for the user to specify a minRange in their units then this would work. The minRange would probably be best specified in weewx.conf or skin.conf and passed throught the respective JSON data files. The other alternative is to have the user edit saratogaplots.js, not really a viable alternative.

Year `windDir` data is always 90 degrees

Function getDaySummaryVectors() is used to calculate a vector of daily aggregate data based on the daily summary tables. The aggregate calculation is based on using different fields in the results of an sql query. These fields are selected based on their order and it appears for some reason the field numbers are no longer correct.

Solution is two part. Firstly rework the sql query to explicitly select fields rather than using *, that way the field order will always be the same/ Secondly, rework the aggregate calculations to ensure the correct fields are being used.

List Index Out of Range

@gjr80 thanks for all your work on this! I've been wanting to generate highchart graphs from weewx data for a while now but just didn't have the skills to make it happen. Yesterday I installed v0.2.0 and got it working on my test weewx box running the simulator. It works fine and no issues generating the JSON files. However when I installed it on my Raspbery Pi connected to my AcuRite 02064C it generates this list index out of range error. The week.json generates fine but I never get the year.json. Looks like something to do with the windrose calculations. Any thoughts on how to fix this?

Running WeeWX 3.7.1

weewx[21257]: reportengine: Caught unrecoverable exception in generator weewx.cheetahgenerator.CheetahGenerator weewx[21257]: **** list index out of range weewx[21257]: **** Traceback (most recent call last): weewx[21257]: **** File "/usr/share/weewx/weewx/reportengine.py", line 239, in run weewx[21257]: **** obj.start() weewx[21257]: **** File "/usr/share/weewx/weewx/reportengine.py", line 273, in start weewx[21257]: **** self.run() weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 157, in run weewx[21257]: **** ngen = self.generate(gen_dict[section_name], self.gen_ts) weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 231, in generate weewx[21257]: **** ngen += self.generate(section[subsection], gen_ts) weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 231, in generate weewx[21257]: **** ngen += self.generate(section[subsection], gen_ts) weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 319, in generate weewx[21257]: **** default_binding) weewx[21257]: **** File "/usr/share/weewx/weewx/cheetahgenerator.py", line 371, in _getSearchList weewx[21257]: **** searchList += obj.get_extension_list(timespan, db_lookup) weewx[21257]: **** File "/usr/share/weewx/user/highchartsSearchX.py", line 1179, in get_extension_list weewx[21257]: **** sle_dict['wr' + _suffix] = self.calcWindRose(timespan, db_lookup, period) weewx[21257]: **** File "/usr/share/weewx/user/highchartsSearchX.py", line 962, in calcWindRose weewx[21257]: **** if (speed_vec_vt[0][i] is None) or (direction_vec_vt[0][i] is None): weewx[21257]: **** IndexError: list index out of range weewx[21257]: **** Generator terminated

Thanks again!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.