コード例 #1
0
        private object BuidSalesChart(DataTable table)
        {
            var chart      = new ChartJsonData();
            var dataSeries = new List <object>();
            var data       = new List <object>();

            foreach (DataRow row in table.Rows)
            {
                var point = new List <object>
                {
                    (Convert.ToDateTime(row["re_date"])).Subtract(new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds,
                    Convert.ToDouble(row["Sales"])
                };
                data.Add(point.ToArray());
            }
            dataSeries.Add(new { data = data.ToArray(), name = Resources.CnE.GDT_ChartSalesName, tooltip = new { valueDecimals = 2 }, marker = new { enabled = false } });
            chart.SeriesData = dataSeries.ToArray();
            return(chart.ToJson());
        }
コード例 #2
0
ファイル: CNEController.cs プロジェクト: radtek/ThomRe
        private object GetCoalChartData(string key)
        {
            var chart      = new ChartJsonData();
            var dataSeries = new List <object>();
            var dataA004   = new List <object>();
            var dataA005   = new List <object>();
            var dataA007   = new List <object>();
            var entrys     = CoalRepository.GetCoalTrafficPortData(key);

            entrys.ForEach(t =>
            {
                var point = new List <object>
                {
                    (Convert.ToDateTime(t.end_date)).Subtract(new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds,
                    Convert.ToDouble(t.A004)
                };
                dataA004.Add(point.ToArray());
                var pointA005 = new List <object>
                {
                    (Convert.ToDateTime(t.end_date)).Subtract(new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds,
                    Convert.ToDouble(t.A005)
                };
                dataA005.Add(pointA005.ToArray());
                var pointA007 = new List <object>
                {
                    (Convert.ToDateTime(t.end_date)).Subtract(new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds,
                    Convert.ToDouble(t.A007)
                };
                dataA007.Add(pointA007.ToArray());
            });
            dataSeries.Add(new { data = dataA004.ToArray(), name = entrys[0].PortName + "-" + Resources.CnE.Coal_Traffic_Railway, marker = new { enabled = false } });
            dataSeries.Add(new { data = dataA005.ToArray(), name = entrys[0].PortName + "-" + Resources.CnE.Coal_Traffic_Road, marker = new { enabled = false } });
            dataSeries.Add(new { data = dataA007.ToArray(), name = entrys[0].PortName + "-" + Resources.CnE.Coal_Traffic_Trough, marker = new { enabled = false } });
            chart.SeriesData = dataSeries.ToArray();

            return(chart.ToJson());
        }