asp.net c# - 堆叠柱形图的多系列 [英] asp.net c# - multi series for stacked column chart

查看:181
本文介绍了asp.net c# - 堆叠柱形图的多系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

买方1买方2买方3

1 2014-01-01 48556.4 0 60861

2 2014-02-01 34002.9 0 10120

3 2014 -03-01 151749.28 0 138680.8

4 2014-04-01 325300.69 0 74245.5

5 2014-05-01 32511.6 0 29583.3

6 2014-06-01 97112.6 0 0

7 2014-07-01 108101.32 5280 93197.72

8 2014-08-01 155682.13 0 167606.1

9 2014-09-01 162979.85 12125 119540.5

10 2014-10-01 42635.5 19797.6 372881.92

11 2014-11-01 67300.6 0 360722.9

12 2014-12-01 35705.3 7131.5 86175

13 2015-01-01 0 3560 0





嗨。

我正在尝试制作关于订单统计数据的堆积柱形图。

我有上面的数据表。



我成功在xAxis打印日期时间



buyer1 buyer2 buyer3
1 2014-01-01 48556.4 0 60861
2 2014-02-01 34002.9 0 10120
3 2014-03-01 151749.28 0 138680.8
4 2014-04-01 325300.69 0 74245.5
5 2014-05-01 32511.6 0 29583.3
6 2014-06-01 97112.6 0 0
7 2014-07-01 108101.32 5280 93197.72
8 2014-08-01 155682.13 0 167606.1
9 2014-09-01 162979.85 12125 119540.5
10 2014-10-01 42635.5 19797.6 372881.92
11 2014-11-01 67300.6 0 360722.9
12 2014-12-01 35705.3 7131.5 86175
13 2015-01-01 0 3560 0


Hi.
I am trying to make stacked column chart about order statistics.
I have datatable like above.

I success to print datetime at xAxis

List<string> lstXaxis = new List<string>();
        for (int i = 0; i < dt.Rows.Count; i++)
        {
            lstXaxis.Add(dt.Rows[i][0].ToString().Substring(0,7));
        }

 DotNet.Highcharts.Highcharts chart = new DotNet.Highcharts.Highcharts("chart1")
         .InitChart(new Chart { DefaultSeriesType = DotNet.Highcharts.Enums.ChartTypes.Column })
         .SetTooltip(new Tooltip { Formatter = "function() { return '' + this.x + '<br/>' + this.series.name + ': ' + this.y + '<br/>' + 'Total: ' + this.point.stackTotal;}" })
         .SetYAxis(new YAxis { Title = new YAxisTitle { Text = "Amount" }, Min = 0 })
         .SetPlotOptions(new PlotOptions { Column = new PlotOptionsColumn { Stacking = Stackings.Normal } })

         .SetTitle(new Title { Text = "ORDER STATISTICS" })
         .SetXAxis(new XAxis
         {
             Categories = lstXaxis.ToArray()
         })





我系列数据有问题

如何将多系列推送到图表?





and I have problem with series data
how can I push multi series to chart?

Series[] series = new Series[dt.Columns.Count];
       for (int j = 0; j <= dt.Columns.Count - 1; j++)
       {
          series[j] = new Series
               {
                   Name = dt.Columns[j].ColumnName.ToString(),
                   for (int k = 1; k < dt.Rows.Count; k++)
                   {
                   Data = new Data(new object[] { dt.Columns[j]("Page Visits") })
               };
           }
       }

推荐答案

我参与过WPF中的Stacked列系列图表,给定的逻辑可能是对场景非常有用。



I have worked on Stacked column series charts in WPF, the given logic may be useful for scenario.

引用:

foreach(lstChartSeries.SelectedItems中的String str )

{

List< keyvaluepair>< string,>> test = new List< keyvaluepair>< string,>>();

foreach(dt.Rows中的DataRow dr)

{

test.Add(new KeyValuePair< string,>(dr [PROJECT]。ToString(),Convert.ToDouble(dr [str] .ToString())));

}



ListSeriesDef [i + 1] .Visibility = Visibility.Visible;

ListSeriesDef [i + 1] .DataContext = test;

i = i + 1;

}

foreach (String str in lstChartSeries.SelectedItems)
{
List<keyvaluepair><string,>> test = new List<keyvaluepair><string,>>();
foreach (DataRow dr in dt.Rows)
{
test.Add(new KeyValuePair<string,>(dr["PROJECT"].ToString(), Convert.ToDouble(dr[str].ToString())));
}

ListSeriesDef[i + 1].Visibility = Visibility.Visible;
ListSeriesDef[i + 1].DataContext = test;
i = i + 1;
}


这篇关于asp.net c# - 堆叠柱形图的多系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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