here config file of high chart
$scope.chartconfig1 = { options: { chart: { bordercolor: '#ebba95', borderwidth: 3, }, }, yaxis: [], tooltip: { headerformat: '<span style="font-size:10px">{point.key}</span><table>', pointformat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' + '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>', footerformat: '</table>', shared: true, usehtml: true }, legend: { enabled: true }, series: [], title: { }, xaxis: { } }
this code snippet inserting data chartconfig1
var yaxisobj = { labels: { style: { color: highcharts.getoptions().colors[1] } }, title: { style: { color: highcharts.getoptions().colors[1] } } }; $scope.maxhistogramgraph = function(){ var startdate = new date($scope.data1.date); var enddate = new date($scope.data2.date); if(parsefloat(startdate.gettime())>= parsefloat(enddate.gettime())){ $scope.histdiv = false; console.log("start date bigger"); alert("your date & time selection wrong"); }else{ $scope.histdiv = true; var finalstartdate = new date($scope.data1.date).toisostring(); var finalenddate = new date($scope.data2.date).toisostring(); var intervalselected = $scope.intervalselected; settemporalfilter(finalstartdate,finalenddate,intervalselected); var attrarray = []; attrarray.push($scope.sensorattrselected); var op = "extended_stats"; var data = aggregations($scope.sensornameselected.sensorname, attrarray, op); $scope.chartconfig1.series = []; var names = []; var finaldata = []; var buck1 = data[1].aggregations.group_by_name.buckets for(var x = 0; x < buck1.length; x++){ var data_series = {"name":buck1[x].key,"data":[]}; angular.foreach(buck1[x].articles_over_time.buckets, function(value, key){ var temdata = []; temdata.push(value.key,value.extended_stats_values.max); data_series.data.push(temdata); /*data_series.max.push(value.extended_stats_values.max); data_series.min.push(value.extended_stats_values.min); data_series.avg.push(value.extended_stats_values.avg); data_series.sum.push(value.extended_stats_values.sum);*/ }); finaldata.push(data_series); }; $scope.chartconfig1.yaxis.push(yaxisobj); console.log("yaxisobj......"); console.log(angular.tojson($scope.chartconfig1.yaxis)); $scope.chartconfig1.series = angular.copy(finaldata); $scope.chartconfig1.xaxis.type = 'datetime'; $scope.chartconfig1.yaxis[0].title.text = $scope.sensorattrselected; $scope.chartconfig1.title.text = $scope.sensorattrselected+" histogram" console.log("$scope.chartconfig1......"); console.log(angular.tojson($scope.chartconfig1)); } };
all data getting inserted , still iam getting error highcharts error #18: www.highcharts.com/errors/18
highcharts error #18
the requested axis not exist
this error happens when set series' xaxis or yaxis property point axis not exist.
please help...!!
instead of using $scope.chartconfig1.yaxis = [yaxisobj]; use $scope.chartconfig1.options.yaxis = [yaxisobj];
Comments
Post a Comment