我想用dyanamic数据启动条形图 [英] I want to launch the bar charts with the dyanamic data

查看:85
本文介绍了我想用dyanamic数据启动条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将控制器功能返回值存储在一个colors变量中,而且我有静态条形图,现在我想借助颜色变量数据启动条形图。



我尝试过:



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);



}





现在我想将这些颜色数据发送到静态酒吧聊天,酒吧聊天必须填充颜色数据。

Barcart.html:


}


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>

推荐答案

(#div1)。text(colors [0] .Item2);
("#div1").text(colors[0].Item2);


(#div2)。text(colors [0] .Item3);
("#div2").text(colors[0].Item3);



}





现在我想将这些颜色数据发送到静态酒吧聊天,酒吧聊天必须填充颜色数据。

Barcart.html:


}


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>


这篇关于我想用dyanamic数据启动条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆