Visifire实现统计图
2015-11-23 10:07
323 查看
/// <summary> /// 柱形图 /// </summary> public static Chart InitCompareChart(string fundName, string tenThousandRate, string sevenRate) { Chart CompareChart = new Chart(); CompareChart.Theme = "Theme3"; Visifire.Charts.Title t = new Visifire.Charts.Title(); t.Text = string.Format("{0}与存款收益比较", fundName); CompareChart.Titles.Add(t); DataSeries dataSeries = new DataSeries { RenderAs = RenderAs.Bar }; dataSeries.LabelEnabled = true; dataSeries.LegendText = "每万元单日收益"; double tenThousandAccrual = 0; Double.TryParse(tenThousandRate, out tenThousandAccrual); dataSeries.DataPoints.Add(new DataPoint { AxisXLabel = fundName, YValue = tenThousandAccrual }); dataSeries.DataPoints.Add(new DataPoint { AxisXLabel = "定期五年", YValue = 1.3014 }); dataSeries.DataPoints.Add(new DataPoint { AxisXLabel = "定期三年", YValue = 1.1644 }); dataSeries.DataPoints.Add(new DataPoint { AxisXLabel = "定期二年", YValue = 1.0274 }); dataSeries.DataPoints.Add(new DataPoint { AxisXLabel = "定期一年", YValue = 0.8219 }); dataSeries.DataPoints.Add(new DataPoint { AxisXLabel = "定期半年", YValue = 0.7671 }); dataSeries.DataPoints.Add(new DataPoint { AxisXLabel = "定期三月", YValue = 0.7123 }); dataSeries.DataPoints.Add(new DataPoint { AxisXLabel = "活期", YValue = 0.0959 }); DataSeries dataSeries2 = new DataSeries { RenderAs = RenderAs.Bar }; dataSeries2.LabelEnabled = true; dataSeries2.LegendText = "七日年化收益率"; double qiRiAnnualizedYield = 0; Double.TryParse(sevenRate.Replace("%", ""), out qiRiAnnualizedYield); dataSeries2.DataPoints.Add(new DataPoint { AxisXLabel = fundName, YValue = qiRiAnnualizedYield }); dataSeries2.DataPoints.Add(new DataPoint { AxisXLabel = "定期五年", YValue = 4.75 }); dataSeries2.DataPoints.Add(new DataPoint { AxisXLabel = "定期三年", YValue = 4.25 }); dataSeries2.DataPoints.Add(new DataPoint { AxisXLabel = "定期二年", YValue = 3.75 }); dataSeries2.DataPoints.Add(new DataPoint { AxisXLabel = "定期一年", YValue = 3.00 }); dataSeries2.DataPoints.Add(new DataPoint { AxisXLabel = "定期半年", YValue = 2.80 }); dataSeries2.DataPoints.Add(new DataPoint { AxisXLabel = "定期三月", YValue = 2.60 }); dataSeries2.DataPoints.Add(new DataPoint { AxisXLabel = "活期", YValue = 0.35 }); CompareChart.Series.Add(dataSeries); CompareChart.Series.Add(dataSeries2); return CompareChart; } /// <summary> ///折线统计图 /// </summary> public static Chart InitTenThousandRateChart(string fundName, List<FundDay> fundDayList) { Chart TrendChart = new Chart(); TrendChart.Theme = "Theme3"; Visifire.Charts.Title t = new Visifire.Charts.Title(); t.Text = string.Format("{0}单日万元收益走势", fundName); TrendChart.Titles.Add(t); DataSeries AccrualSeries = new DataSeries { RenderAs = RenderAs.Line }; AccrualSeries.LabelEnabled = true; AccrualSeries.LegendText = "每万元单日收益"; int listCount = fundDayList.Count; int dayIndex = (listCount >= 7) ? 6 : listCount;//限定最多只能取七天的数据做走势图,并且保证时间轴(X轴)的最右端是最新日期 if (listCount > 0) { while (dayIndex >= 0) { FundDay fundDay = fundDayList[dayIndex]; string date = fundDay.Date.Substring(fundDay.Date.IndexOf("-") + 1); double tenThousandAccrual = 0; Double.TryParse(fundDay.TenThousandRate, out tenThousandAccrual); AccrualSeries.DataPoints.Add(new DataPoint { AxisXLabel = date, YValue = tenThousandAccrual }); dayIndex--; } } Axis a = new Axis(); a.StartFromZero = false; TrendChart.AxesY.Add(a); TrendChart.Series.Add(AccrualSeries); return TrendChart; }
相关文章推荐
- SOJ 2818_QQ音速
- VSS Invalid Handle 登录时的问题
- SOJ 2818_QQ音速
- 我的书单
- 类型
- 使用jquery实现鼠标滑过弹出更多相关信息层附源码下载
- 华为OJ基础篇-iNOC产品部–完全数计算
- Java String.getChars()
- spring + redis 实现数据的缓存
- ios 64位下编译webrtc的libvpx库出现错误Bad cputype for object file.Currently only tested for CPU_TYPE_x86_64
- 平安医保权限管理关系
- 修改servlet的模板代码
- linux消息列队
- android中的帧动画(Frame)+图片自动播放器(ViewFlipper)
- 用例图
- 《Effective JavaScript》- 1.4 原始类型优于封装对象
- maven配置jetty
- 关于“warning LNK4099: 未找到 PDB“vc90.pdb”的解决办法
- Memcached在使用中常用到的方法
- btrfs-snapper 实现Linux 文件系统快照回滚