

Graphics g = e.Graphics;
Pen p = new Pen(Color.Red, 1);//上涨
Pen p1 = new Pen(Color.Green, 1);//下跌
int width = 600;
int height = 400;
g.DrawRectangle(p, 80, 80, width, height);
//k线开始
Font myFont = new Font(“微软雅黑”, 8);
//float angle = 20; //角度
float x = 0;
string begindate = null;
string jintian = DateTime.Now.ToShortDateString().ToString();
DataSet ds = null;
DataTable dt = null;
string sql = “select top 10 begindate,dayopen,dayclose,dayhigh,daylow from datetest where begindate<=’” + jintian + “’ order by begindate desc”;
ds = db.getds(sql, “mminfo”);
dt=ds.Tables[0];
decimal high = (decimal)dt.Compute(“Max(dayhigh)”, null);//选择的K线组合中最高价
decimal low = (decimal)dt.Compute(“Min
C#画K线实现纵轴价格和横轴日期动态变化
最新推荐文章于 2022-05-17 12:08:27 发布
这篇博客介绍了如何使用C#编程语言绘制动态K线图表,包括设置颜色、绘制矩形、处理数据以及计算横轴日期和纵轴价格的变化。通过查询数据库获取历史数据,计算K线组合中的最高价和最低价,进而划分横轴时间间隔和纵轴价格比例,最终实现价格随日期动态变化的K线展示。

最低0.47元/天 解锁文章
333

被折叠的 条评论
为什么被折叠?



