当前位置: 首页 > news >正文

Visifire实现统计图

        /// <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;
        }

 

转载于:https://www.cnblogs.com/AlvinLiang/p/4987566.html

相关文章:

  • SecureCRT系列:生成公私钥
  • 技巧之:恢复linux被误删文件(方案有3)
  • 非法词判断
  • 教你爱上Blocks(闭包)
  • 【python游戏编程之旅】第四篇---pygame中加载位图与常用的数学函数。
  • 导出excel
  • Oracle坑爹入门踩坑篇
  • GPU大百科全书索引(有助于理解openGL工作流程)
  • 数据结构实例参考——“查找”的原理
  • git clone Gtk-WARNING **: cannot open display
  • 利用MAVEN打包时,如何包含更多的资源文件
  • js ajax 1
  • Linux git 文档
  • SQL2005SP4补丁安装时错误: -2146233087 MSDTC 无法读取配置信息。。。错误代码1603的解决办法...
  • 如何对DevExpress ASPxGridView进行分组排序?
  • hexo+github搭建个人博客
  • Centos6.8 使用rpm安装mysql5.7
  • java8-模拟hadoop
  • k8s如何管理Pod
  • OpenStack安装流程(juno版)- 添加网络服务(neutron)- controller节点
  • Travix是如何部署应用程序到Kubernetes上的
  • vue脚手架vue-cli
  • 第13期 DApp 榜单 :来,吃我这波安利
  • 爬虫进阶 -- 神级程序员:让你的爬虫就像人类的用户行为!
  • 前端面试题总结
  • 原生Ajax
  • 正则与JS中的正则
  • Java数据解析之JSON
  • 宾利慕尚创始人典藏版国内首秀,2025年前实现全系车型电动化 | 2019上海车展 ...
  • #### go map 底层结构 ####
  • ###STL(标准模板库)
  • #DBA杂记1
  • (zhuan) 一些RL的文献(及笔记)
  • (二)【Jmeter】专栏实战项目靶场drupal部署
  • (附源码)spring boot建达集团公司平台 毕业设计 141538
  • (五)大数据实战——使用模板虚拟机实现hadoop集群虚拟机克隆及网络相关配置
  • (一)基于IDEA的JAVA基础1
  • (译)计算距离、方位和更多经纬度之间的点
  • (原創) 如何讓IE7按第二次Ctrl + Tab時,回到原來的索引標籤? (Web) (IE) (OS) (Windows)...
  • (转)如何上传第三方jar包至Maven私服让maven项目可以使用第三方jar包
  • ... fatal error LINK1120:1个无法解析的外部命令 的解决办法
  • .aanva
  • .NET 回调、接口回调、 委托
  • .NET学习教程二——.net基础定义+VS常用设置
  • .vue文件怎么使用_我在项目中是这样配置Vue的
  • .xml 下拉列表_RecyclerView嵌套recyclerview实现二级下拉列表,包含自定义IOS对话框...
  • 。Net下Windows服务程序开发疑惑
  • @FeignClient 调用另一个服务的test环境,实际上却调用了另一个环境testone的接口,这其中牵扯到k8s容器外容器内的问题,注册到eureka上的是容器外的旧版本...
  • @Pointcut 使用
  • [AIGC] 如何建立和优化你的工作流?
  • [Angularjs]ng-select和ng-options
  • [BROADCASTING]tensor的扩散机制
  • [C#C++]类CLASS
  • [codeforces]Levko and Permutation
  • [error] 17755#0: *58522 readv() failed (104: Connection reset by peer) while reading upstream