let point = g.speedometer['series'][0].data[0]
let newVal: any
let inc = Math.round((Math.random() - 0.5) * 20);
newVal = point + inc;
if (newVal < 0 || newVal > 200) {
newVal = point - inc;
}
console.log('new',newVal)
//point.update(newVal);
console.log('speed',g.speedometer['series'][0].data[0])
}, 2000);
} // end speedometer()_
Module Code -
// Highcharts
_import { ChartModule } from 'angular2-highcharts';
import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';
import as highchart from 'highcharts';
import as highchartsHeatmap from 'highcharts/modules/heatmap';
import as highchartsTreemap from 'highcharts/modules/treemap';
import as HighchartsDrilldown from 'highcharts/modules/drilldown';
// Service
import { AceDeviceService } from "../device/device.service";
// For loading highcharts
declare let require:any;
export function highchartsFactory() {
const hc = require('highcharts');
const hcm = require('highcharts/highcharts-more');
const exporting = require('highcharts/modules/exporting');
const sg = require('highcharts/modules/solid-gauge');
Needed Dynamic charts using angular 4 - Observed no such way to make dynamic gauge chart in angular 4.
Code -
Component File - _speedMeter(){ //Speed this.speedometer = { chart: { type: 'gauge', plotBackgroundColor: null, plotBackgroundImage: null, plotBorderWidth: 0, plotShadow: false, marginRight: 0, height: 180, },
title: { text: 'Speed' }, credits: { enabled: false }, pane: { size: 140, startAngle: -130, endAngle: 130,
},
// the value axis yAxis: { min: 0, max: 200,
},
series: [{ name: 'Speed', data: [100] // data: (function () { // setInterval(function () { // var point = this.speedometer.series[0].points[0], // newVal, // inc = Math.round((Math.random() - 0.5) * 20);
}] } const g = this;
setInterval(function () {
// g.speedometer['series'][0].data[0].update(Math.round((Math.random() - 0.5) * 20))
}, 2000);
} // end speedometer()_
Module Code - // Highcharts _import { ChartModule } from 'angular2-highcharts'; import { HighchartsStatic } from 'angular2-highcharts/dist/HighchartsService';
import as highchart from 'highcharts'; import as highchartsHeatmap from 'highcharts/modules/heatmap'; import as highchartsTreemap from 'highcharts/modules/treemap'; import as HighchartsDrilldown from 'highcharts/modules/drilldown'; // Service import { AceDeviceService } from "../device/device.service"; // For loading highcharts declare let require:any; export function highchartsFactory() { const hc = require('highcharts'); const hcm = require('highcharts/highcharts-more'); const exporting = require('highcharts/modules/exporting'); const sg = require('highcharts/modules/solid-gauge');
}_ Need help. Solution specific to Angular 4 required.