Click here to Skip to main content
15,888,210 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have stored the controller function return value in the one "colors" variable ,And I have the static bar charts ,now I want to launch the barcharts with the help of colors variable data.

What I have tried:

function onChangeId(event) {
        jQuery.ajax({
            url: "Home/PopulateValues",
            type: 'POST',
            data: { ipaddress: event.value },
            success: function (result) {
                colors = JSON.parse(result);
                $("#div1").text(colors[0].Item2);
                $("#div2").text(colors[0].Item3);

}


now I wanna to send this colors data to the static bar chats,the bar chat has to populate with the colors data.
Barcart.html:
script>
        var chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                defaultSeriesType: 'column',
                backgroundColor: '#eee',
                plotBackgroundColor: '#fff',
            },
            credits: { enabled: false },
            title: {
                text: 'Histogram Chart'
            },
            subtitle: {
                text: '<p style="color:red">Chart For Total Impressions</p>'
            },
            tooltip: {
                borderWidth: 1,
                formatter: function () {
                    return this.x + '<br/>' +
                    'Count: ' + this.y;
                }
            },
            plotOptions: {
                column: {
                    shadow: false,
                    borderWidth: .5,
                    borderColor: '#666',
                    pointPadding: 0,
                    groupPadding: 0,
                    color: 'rgba(204,204,204,.85)'
                }
            },
            xAxis: {
                categories: ['Color', 'B&W', 'B&W printed on<br> color printer'],
                labels: {
                    style: {
                        fontSize: '15px',
                        fontWeight: 'normal',
                        color: '#488'
                    },
                },
                lineWidth: 0,
                lineColor: '#999',
                tickLength: 70,
                tickColor: '#ccc',
            },
            yAxis: {
                title: { text: 'Impressions' },
                tickColor: '#ccc',
                lineColor: '#ccc',
            },
            series: [{
                name: 'Histogram',
                data: [234, 418, 126],//instead of this static data I need to pass the dynamic data which I get in colors variable.
            }]
        });
    </script>
Posted

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