javascript - HighCharts with Dynamic Data not working -
i have asp.net mvc project signalr.
i have page highchart , script looks this:
$(function () { window.highcharts.setoptions({ global: { useutc: false } }); var chart; $(document).ready(function () { chart = new highcharts.chart({ chart: { renderto: 'container', type: 'line', marginright: 10 }, title: { text: 'gmas queues' }, xaxis: { type: 'datetime', tickinterval: 500, labels: { enabled: false } }, yaxis: { title: { text: 'queue count' }, plotlines: [{ value: 0, width: 1, color: '#808080' }] }, legend: { enabled: false }, exporting: { enabled: false }, series: [{ name: 'processing queues' }] }); }); $.connection.hub.logging = true; // reference auto-generated proxy hub. var chartdata = $.connection.processingqueueshub; // create function hub can call display messages. chartdata.client.updatequeuecounts = function (data) { //$.each(data, function(i, item) { // // add message page. // $('#chartdatalog').append('<li><strong>' + htmlencode(item.queuename) // + '</strong>: ' + htmlencode(item.length) + '</li>'); //}); // set updating of chart. var series = chart.series[0]; $.each(data, function (i, item) { if (item.queuename == "queue a") { var x = date.parse(item.date), y = item.length; series.addpoint([x, y], true, false); } }); };
however, see graph not points. strange part series data points there:
anyone know why highcharts not rendering points?
thanks, bill n
i have thank friend , co developer figuring out. smarter , braver man me. :) went highcharts source , found highcharts breaks if add graph series before initial animation completed. animation why clip-rect zero-width (it animates 0 full width on 1s when first create chart). end adding point series before animation starts. kills animation doesn’t fix width of clip-rect. fix add animation false series.
series: [{ name: 'processing queues', data: [], animation: false }]
Comments
Post a Comment