Click here to Skip to main content
15,888,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello
I Want Show Real-Time Chart Via Asp.Net Component highcharts
When Used Control Timer And UpdatePanel Of AjaxControl Not Working True
HTML
<script type="text/javascript">
    $(function () {
        $(document).ready(function () {
            var ZZ = 0;
            var Z = 0;
            setInterval(function () {
                ZZ = parseInt(document.getElementById("MeMeMe").innerHTML);
                Z = Z / 2;
            }, 1000);
            Highcharts.setOptions({
                global: {
                    useUTC: true
                }
            });

            $('#container').highcharts({
                chart: {
                    type: 'spline',
                    animation: Highcharts.svg,
                    marginRight: 10,
                    events: {
                        load: function () {
                            var series = this.series[0];
                            setInterval(function () {
                                var x = (new Date()).getTime(),
                                    y = ZZ;
                                series.addPoint([x, y], true, true);
                            }, 1000);
                        }
                    }
                },
                title: {
                    text: 'Live random data'
                },
                xAxis: {
                    type: 'datetime',
                    tickPixelInterval: 550,
                    tickInterval: 2000,
                },
                yAxis: {
                    title: {
                        text: 'Value'
                    },
                    plotLines: [{
                        value: 0,
                        width: 1,
                        color: '#818121'
                    }]
                },
                tooltip: {
                    formatter: function () {
                        return '<b>' + this.series.name + '</b><br/>' +
                            Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) + '<br/>' +
                            Highcharts.numberFormat(this.y, 2);
                    }
                },
                legend: {
                    enabled: false
                },
                exporting: {
                    enabled: false
                },
                series: [{
                    name: 'Random',
                    data: (function () {
                        // generate an array of random data
                        var data = [],
                            time = (new Date()).getTime(),
                            i;

                        for (i = -20; i <= 0; i += 1) {
                            data.push({
                                x: time + i * 1000,
                                y: ZZ
                            });
                        }
                        return data;
                    }())
                }, {
                    name: 'Me',
                    data: (function () {
                        // generate an array of random data
                        var data = [],
                            time = (new Date()).getTime(),
                            i;

                        for (i = -20; i <= 0; i += 1) {
                            data.push({
                                x: time + i * 1000,
                                y: Math.random()
                            });
                        }
                        return data;
                    }())
                }]
            });
        });
    });
</script>



this script show two line in one chart for 20 points but i want ever 1000 miliseconds set points in line

Please Help Or Show Me Sample Code
Regards Yarian
Thanks Very Much For All Programming

What I have tried:

for demo code check below link
Spline updating each second |
Highcharts
[^]
Posted
Updated 17-Oct-16 9:25am
v3
Comments
Maciej Los 15-Oct-16 16:44pm    
"Not working" is not informative at all!
Please, provide your code and more details about your issue (what's not working...).
misaqyrn9677 16-Oct-16 10:53am    
insert my code

Try Vis Js its able to display realtime charts and is easy to use. Plus its Pure javascript and is supported in many browsers
 
Share this answer
 
Comments
misaqyrn9677 16-Oct-16 12:55pm    
this chart can't used multi chart
I wouldn't personally recommend on using UpdatePanel for this. Instead I would suggest you to use SignalR instead. Here's one example I wrote recently that may help you: Real-Time Poll Vote Results Using SignalR 2, MVC, Web API 2, jQuery And HighCharts[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900