C#下如何用NPlot绘制期货股票K线图:设计要显示的股票价格图表窗口并定义相应类的成员及函数

Posted 区块链智能合约

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了C#下如何用NPlot绘制期货股票K线图:设计要显示的股票价格图表窗口并定义相应类的成员及函数相关的知识,希望对你有一定的参考价值。

[内容简介]

上一篇介绍了要显示K线图所需要的数据结构,及要动态显示K线图,需要动态读取数据文件必需的几个功能函数.本篇介绍要显示蜡烛图所用到的窗口界面设计及对应类定义.下面分述如下:

[窗口界面] 见下图

 

上图中对应各周期功能按钮和标签进行相应拖放操作就是了, 不再多述 .倒是图表区为一个Nplot控件,命名:myPlot.

[窗口类定义]

  1. 界面部分自动生成的代码文件:

///<ctp1.Designer.cs>

///K线图窗口界面代码此代码由VS自动生成。

//------------------------------------------------------------------------------

 

namespace Ctp

{

partialclassFormCtpThread

{

///<summary>

/// Required designer variable.

///</summary>

private System.ComponentModel.IContainer components = null;

 

///<summary>

/// Clean up any resources being used.

///</summary>

///<param name="disposing">true if managed resources should be disposed; otherwise, false.</param>

protectedoverridevoid Dispose(bool disposing)

{

if (disposing && (components != null))

{

components.Dispose();

}

base.Dispose(disposing);

}

 

#region Windows Form Designer generated code

 

///<summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

///</summary>

privatevoid InitializeComponent()

{

this.menuStrip1 = new System.Windows.Forms.MenuStrip();

this.M5 = new System.Windows.Forms.Button();

this.myPlot = new NPlot.Windows.PlotSurface2D();

this.M1 = new System.Windows.Forms.Button();

this.M15 = new System.Windows.Forms.Button();

this.M30 = new System.Windows.Forms.Button();

this.H1 = new System.Windows.Forms.Button();

this.D1 = new System.Windows.Forms.Button();

this.W1 = new System.Windows.Forms.Button();

this.Mn1 = new System.Windows.Forms.Button();

this.label_symbol = new System.Windows.Forms.Label();

this.label1 = new System.Windows.Forms.Label();

this.textBox1 = new System.Windows.Forms.TextBox();

this.enlarge = new System.Windows.Forms.Button();

this.shrink = new System.Windows.Forms.Button();

this.labelTime = new System.Windows.Forms.Label();

this.button3 = new System.Windows.Forms.Button();

this.buttonRoll = new System.Windows.Forms.Button();

this.textBox2 = new System.Windows.Forms.TextBox();

this.buttonMove = new System.Windows.Forms.Button();

this.SuspendLayout();

//

// menuStrip1

//

this.menuStrip1.Location = new System.Drawing.Point(0, 0);

this.menuStrip1.Name = "menuStrip1";

this.menuStrip1.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;

this.menuStrip1.Size = new System.Drawing.Size(1049, 24);

this.menuStrip1.TabIndex = 1;

this.menuStrip1.Text = "menuStrip1";

//

// M5

//

this.M5.AutoSize = true;

this.M5.CausesValidation = false;

this.M5.Location = new System.Drawing.Point(337, 0);

this.M5.Name = "M5";

this.M5.Size = new System.Drawing.Size(39, 24);

this.M5.TabIndex = 2;

this.M5.TabStop = false;

this.M5.Text = "5";

this.M5.UseVisualStyleBackColor = true;

this.M5.Click += new System.EventHandler(this.M5_Click);

//

// myPlot

//

this.myPlot.AutoScaleAutoGeneratedAxes = false;

this.myPlot.AutoScaleTitle = false;

this.myPlot.BackColor = System.Drawing.Color.White;

this.myPlot.DateTimeToolTip = true;

this.myPlot.Dock = System.Windows.Forms.DockStyle.Fill;

this.myPlot.ForeColor = System.Drawing.Color.White;

this.myPlot.Legend = null;

this.myPlot.LegendZOrder = -1;

this.myPlot.Location = new System.Drawing.Point(0, 24);

this.myPlot.Name = "myPlot";

this.myPlot.RightMenu = null;

this.myPlot.ShowCoordinates = true;

this.myPlot.Size = new System.Drawing.Size(1049, 414);

this.myPlot.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.None;

this.myPlot.TabIndex = 1;

this.myPlot.Text = "myPlotSurface2D1";

this.myPlot.Title = "";

this.myPlot.TitleFont = new System.Drawing.Font("Arial", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);

this.myPlot.XAxis1 = null;

this.myPlot.XAxis2 = null;

this.myPlot.YAxis1 = null;

this.myPlot.YAxis2 = null;

//

// M1

//

this.M1.AutoSize = true;

this.M1.CausesValidation = false;

this.M1.Location = new System.Drawing.Point(301, 0);

this.M1.Name = "M1";

this.M1.Size = new System.Drawing.Size(39, 24);

this.M1.TabIndex = 4;

this.M1.TabStop = false;

this.M1.Text = "1";

this.M1.UseVisualStyleBackColor = true;

this.M1.Click += new System.EventHandler(this.M1_Click);

//

// M15

//

this.M15.AutoSize = true;

this.M15.CausesValidation = false;

this.M15.Location = new System.Drawing.Point(373, 0);

this.M15.Name = "M15";

this.M15.Size = new System.Drawing.Size(39, 24);

this.M15.TabIndex = 6;

this.M15.TabStop = false;

this.M15.Text = "15";

this.M15.UseVisualStyleBackColor = true;

this.M15.Click += new System.EventHandler(this.M15_Click);

//

// M30

//

this.M30.AutoSize = true;

this.M30.CausesValidation = false;

this.M30.Location = new System.Drawing.Point(410, 0);

this.M30.Name = "M30";

this.M30.Size = new System.Drawing.Size(39, 24);

this.M30.TabIndex = 5;

this.M30.TabStop = false;

this.M30.Text = "30";

this.M30.UseVisualStyleBackColor = true;

this.M30.Click += new System.EventHandler(this.M30_Click);

//

// H1

//

this.H1.AutoSize = true;

this.H1.CausesValidation = false;

this.H1.Location = new System.Drawing.Point(448, 0);

this.H1.Name = "H1";

this.H1.Size = new System.Drawing.Size(39, 24);

this.H1.TabIndex = 8;

this.H1.TabStop = false;

thisC#下如何用NPlot绘制期货股票K线图:读取数据文件让K线图自动更新

Canvas绘制股票K线图

利用JFreeChart绘制股票K线图完整解决方案

WPF中使用amCharts绘制股票K线图

plotly基于dataframe数据绘制股票自定义K线图

plotly基于dataframe数据绘制股票K线图并过滤非交易时间

(c)2006-2024 SYSTEM All Rights Reserved IT常识