C# 关于WinForm 中的自带控件 chart1 竖形统计图 使用。
百度查了好久都每找到自己想要的效果
经过一天头痛的摸索终于弄出来了,关键在于Points
/// <summary>
/// 更新图像图
/// </summary>
public void ChartSeriesDataPoint(double dP1, double dP2, double dP3)
{
chart1.Series["Series1"].Points.Clear();
chart1.Series.Clear();
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint1 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(0D, dP1);
dataPoint1.AxisLabel = "自定义名称";
dataPoint1.BorderWidth = 0;
dataPoint1.Font = new System.Drawing.Font("隶书", 9.75F, System.Drawing.FontStyle.Bold);
dataPoint1.IsValueShownAsLabel = true;
dataPoint1.IsVisibleInLegend = true;
dataPoint1.LabelBorderWidth = 0;
dataPoint1.LabelForeColor = System.Drawing.Color.Red;
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint2 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(0D, dP2);
dataPoint2.AxisLabel = "自定义名称";
dataPoint2.Font = new System.Drawing.Font("隶书", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataPoint2.IsValueShownAsLabel = true;
dataPoint2.LabelForeColor = System.Drawing.Color.Red;
System.Windows.Forms.DataVisualization.Charting.DataPoint dataPoint3 = new System.Windows.Forms.DataVisualization.Charting.DataPoint(0D, dP3);
dataPoint3.AxisLabel = "自定义名称";
dataPoint3.BorderDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.NotSet;
dataPoint3.BorderWidth = 0;
dataPoint3.Font = new System.Drawing.Font("隶书", 9.75F, System.Drawing.FontStyle.Bold);
dataPoint3.IsValueShownAsLabel = true;
dataPoint3.LabelForeColor = System.Drawing.Color.Red;
System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
series1.ChartArea = "ChartArea1";
series1.Font = new System.Drawing.Font("微软雅黑", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
series1.IsValueShownAsLabel = true;
series1.IsXValueIndexed = true;
series1.LabelBorderWidth = 0;
series1.MarkerBorderWidth = 2;
series1.MarkerSize = 0;
series1.MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Star10;
series1.Name = "Series1";
series1.Points.Add(dataPoint1);
series1.Points.Add(dataPoint2);
series1.Points.Add(dataPoint3);
this.chart1.Series.Add(series1);
this.chart1.Update();
this.chart1.UpdateAnnotations();
}
虽然有点蠢,但是实在能用比一些要收费的还是简单的,微软爹万岁。
欢迎关注LuoCore 微信公众号,大家学习winform控件使用方法
C# 关于WinForm 中的自带控件 chart1 竖形统计图 使用。的更多相关文章
- WinForm中使用AnyCAD三维控件 の 初始化
在WinForm中可以方便的集成AnyCAD.Net三维控件,只需要以下几部即可完成. 一.添加DLL程序集 AnyCAD.Foundation.Net.dll AnyCAD.Presentation ...
- winform中如何使用timer控件实现欢迎(初始加载)窗口
第一步.新建窗体项目命名为:TestWelcomeFrm,如下图: 第二步.在新项目中,增加欢迎窗口,命名为WelFrm,整个项目目录如下: 第三步.修改program.cs中启动代码如下: WelF ...
- winform中的时间轴控件
我现在做的项目遇到一个需求,就是有没有类似的控件: 我要实现的功能是:播放录像. 某个时间段内假如有2个录像,这个坐标表示的是时间,假如我现在拖动时间轴,拖到第一个录像里面开始播放第一个录像,拖到2个 ...
- c#winform中如何修改ListView控件每个单元格的颜色
ListView在View属性为Details的时候它呈现的方式和DataGirdView差不多,它的每一行都是一个ListViewItem,然而每个ListViewItem都有一个BackColor ...
- 【原创】WinForm中实现单独Time控件的方式
WinForm默认只提供了DateTimePicker,今天的项目只用时间,不能出现日期,百撕不得骑姐(^^),也没花多少时间,随便试了一下,就成功了,分享一下. 在DateTimePicker属性中 ...
- WinForm中使用自定义Tooltip控件
private ToolTip tooltipCtr; 构造函数中: 隐藏默认的Tooltip:this.ShowCellToolTips = false; this.tooltipCtr = new ...
- 实时刷新winform中的某一个控件上的文字
需要注意的是,必须从UI线程,另外启动一个线程才可以. 在新线程调用异步刷新就OK了 Thread thread; private void button1_Click(object sender, ...
- WinForm/Silverlight多线程编程中如何更新UI控件的值
单线程的winfom程序中,设置一个控件的值是很easy的事情,直接 this.TextBox1.value = "Hello World!";就搞定了,但是如果在一个新线程中这么 ...
- 在Winform开发框架中,利用DevExpress控件实现数据的快速录入和选择
在实际的项目开发过程中,有好的控件或者功能模块,我都是想办法尽可能集成到我的WInform开发框架中,这样后面开发项目起来,就可以节省很多研究时间,并能重复使用,非常高效方便.在我很早之前的一篇博客& ...
- WinForm界面开发之布局控件"WeifenLuo.WinFormsUI.Docking"的使用
WinForm界面开发之布局控件"WeifenLuo.WinFormsUI.Docking"的使用 转自:http://www.cnblogs.com/wuhuacong/arch ...
随机推荐
- 要命的DRG成本核算!
改开几十年的三座大山之一,鬼见愁的问题.会随着DRG的推进而让平头老百姓过上翻身做主的日子呢!? 对于DRG,首先医保部门需要了解病种成本状况,确定给你结算多少银子.第二,咱们医院靠医保吃饭,那就更需 ...
- TGCTF2025 部分题目WP
TGCTF 2025 Web AAA偷渡阴平 ?tgctf2025=eval(end(current(get_defined_vars())));&b=system('cat /flag'); ...
- 从excle中读取数据的方法
倒入两个库:ExcelLibrary,Collections 首先,必须注意文件格式为xls 表格内容 open_Excel C:\\Users\\Beckham\\Desktop\\a.xls ...
- 如何在 MySQL 中监控和优化慢 SQL?
如何在 MySQL 中监控和优化慢 SQL? 在 MySQL 中,慢 SQL 查询是指那些执行时间较长的查询,通常会影响数据库的性能和响应时间.通过监控和优化这些慢 SQL 查询,可以提高数据库的效率 ...
- JVM 的 TLAB(Thread-Local Allocation Buffer)是什么?
JVM 的 TLAB(Thread-Local Allocation Buffer)是什么? TLAB(Thread-Local Allocation Buffer)简介 TLAB(Thread-Lo ...
- JDK的SPI有什么缺陷?dubbo做了什么改进?
JDK的SPI机制的缺点 ⽂件中的所有类都会被加载且被实例化.这样也就导致获取某个实现类的方式不够灵活,只能通过 Iterator 形式获取,不能根据某个参数来获取对应的实现类.如果不想用某些实现类, ...
- 2025dsfz集训Day6: 数论
DAY6: 数论 \[Designed\ By\ FrankWkd\ -\ Luogu@Lwj54joy,uid=845400 \] 特别感谢 此次课的主讲 - Kwling 快速幂 快速幂是针对快速 ...
- 关闭windows10 Alt+Tab开打edge选项卡
发现最近更新的windows10会使用快捷键Alt+Tab打开Edge的选项卡,很不适应,可喜的是微软提供了关闭的方法. 设置⚙->系统->多任务处理->Alt+Tab 设置为仅打开 ...
- 代码随想录第二十二天 | Leecode 77. 组合、216. 组合总和 III、17. 电话号码的字母组合
Leecode 77. 组合 题目描述 给定两个整数 n 和 k,返回范围 [1, n] 中所有可能的 k个数的组合. 你可以按 任何顺序 返回答案. 示例 1: 输入:n = 4, k = 2 输出 ...
- 【记录】ChatGPT|使用技巧(更新至2023年2月8日)
昨天,2022年12月13日,在下午和晚上,ChatGPT 就开始因为请求过多而写到一半就崩溃,出现network error,可见它的关注度确实是越来越可观了. 正好最近世界杯,有博客活动, ...