[Ovmsdev] Highcharts help

Michael Balzer dexter at expeedo.de
Sun Sep 6 21:46:21 HKT 2020


Derek,

from your code snippet you've defined "chargechart", but try to access
"chargeChart" later on.

Also $(…).chart() does not return a Highcharts object, but the jQuery
DOM object collection passed to it (for chaining).

The correct way to get a reference to the actual Highcharts object is
using/remembering "this" in the load event, that is pointing to the
Highcharts instance.

Regards,
Michael


Am 06.09.20 um 12:27 schrieb Derek Caudwell:
> Hi all,
>
> Appreciate some help on the best way to initialise Highcharts when
> developing a web plugin -  I am wanting to extend the bms/cellmon to
> include shunt state and an extra chart showing charge rate, SOC,
> battery temp etc. I started by copying the js code from bms/cellmon
> page however I could not replicate the initialisation which calls a
> separate javascript if Highcharts is not loaded before initialisation. 
>
> I also tried a cut down version of the Trip Power Chart (without
> history) initialising in the main script code with:
> chargechart = $('#chargechart').chart({
>     chart: {
>       type: 'line',
>       events: {
>         load: function () {$('#chgreceiver').on("msg:metrics",
> function(e, update){
>               if (update["v.b.soc"] != null) {
>                  updateChart();
>                }
>             });
>           } etc
>
> however in updateChart() I cannot reference chargeChart to addPoints?
>
> Cheers
> Derek
>
>
>
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.openvehicles.com
> http://lists.openvehicles.com/mailman/listinfo/ovmsdev

-- 
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20200906/3b5975a2/attachment.html>


More information about the OvmsDev mailing list