Home 소개       다운로드       온라인 설명서      주식/코인 차트    Q & A     Blog    

히포차트 4.3 - 주식 봉 차트 HTS 프로그램 개발하기







히포차트 4.3 최신 버전으로 개발된 주식차트 프로그램의 샘플 전체 소스입니다.

이 프로젝트는 별도의 강좌로 다시 알아봅니다.

주식차트 그리는 방법, 스크롤 응용 개발, 현재가, 거래량 등 실질적으로 개발이 가능하도록 샘플을 제공하고 지속적으로 업데이트를 제공할 예정입니다.




Candle chart  Candle chart2  주식 캔들 차트 - 최고가, 최저가, 특정 봉 정보  히포차트 4.1 - 주식 차트 활용 (틱 배경색), Area라인 차트  히포차트 4.3 - 주식 봉 차트 HTS 프로그램 개발하기  키움증권 OpenAPI 로 제작된 실시간 주식 차트 프로그램  [히포차트 4.3] - 주식 캔들 차트 보조지표 일목균형표  히포차트 4.3 - 주식차트 20일 이동평균선 그리기  히포차트 4.3 - 주식차트 보조지표 MACD, 시그널, 오실레이터, 지수이동평균선  히포차트 4.3 - 주식차트 보조지표 볼린저밴드(Bollinger Band) 그리기  히포차트 4.3 - 스토캐스틱(Stochastics) 주식차트 보조지표  히포차트 4.3 - 주식 차트 보조지표 RSI 공식적용 그래프  


C#
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Hippo;
using Hippo.WindowsForm4;

namespace Hippo43StockHTSSample
{
public partial class Form1 : Form
{
SeriesList sList;
SeriesList sList2;

SeriesItem[] items;
SeriesItem[] items2;

// 총 데이터 수
int totalCount = 1000;

// 차트 한 화면에 보여줄 개수
int counts = 100;

public Form1()
{
InitializeComponent();

Figures.CoordinateXtextLimitEmpty = 0;
}

private void Form1_Load(object sender, EventArgs e)
{
timer1.Interval = 1000;

Init();

//Draw();
}

private void Init()
{
sList = new SeriesList();
sList2 = new SeriesList();

sList.SeriesCollection.Add(new Series());
sList2.SeriesCollection.Add(new Series());

items = new SeriesItem[totalCount];
items2 = new SeriesItem[totalCount];

Random R = new Random();

for(int i = 1; i < totalCount + 1; i++)
{
SeriesItem item = new SeriesItem();
SeriesItem item2 = new SeriesItem();

item.XDateTimeValue = DateTime.Parse("2013-01-01").AddDays(i);
item2.XDateTimeValue = DateTime.Parse("2013-01-01").AddDays(i);

item.YStartValue = R.Next(1000, 1050) * i - 11 * i; // 시가
item.LowValue = R.Next(1000, 1050) * i - 12 * i; // 저가
item.YValue = R.Next(1000, 1050) * i - 15 * i; // 종가
item.HighValue = R.Next(1000, 1050) * i - 10 * i; // 고가

if (i > 950 && i < 990)
{
item.YStartValue = R.Next(950, 1000) * i - 33 * i; // 시가
item.LowValue = R.Next(950, 1000) * i - 22 * i; // 저가
item.YValue = R.Next(950, 1000) * i - 30 * i; // 종가
item.HighValue = R.Next(950, 1000) * i - 14 * i; // 고가
}

if (i > 200 && i < 600)
{
item.YStartValue = R.Next(1100, 1200) * i - 40 * i; // 시가
item.LowValue = R.Next(1100, 1200) * i - 60 * i; // 저가
item.YValue = R.Next(1100, 1200) * i - 30 * i; // 종가
item.HighValue = R.Next(1100, 1200) * i - 10 * i; // 고가
}


item2.YValue = R.Next(10000, 20000);

items.SetValue(item, i - 1);
items2.SetValue(item2, i - 1);
}


// 가장 뒤에 100 개를 먼저 그린다.

for(int i = totalCount - 1; i > totalCount - 1 - counts; i--)
{
sList.SeriesCollection[0].items.Add(items[i]);
sList2.SeriesCollection[0].items.Add(items2[i]);
}



sList.ChartType = ChartType.CandleStick;
sList.AxisFactor.YAxis.Direction = AxisDirection.Right;
sList.AxisFactor.XAxis.DataType = AxisDataType.DateTime;
sList.AxisFactor.XAxis.DateTimeLabelType = DateTimeLabelType.Day;
sList.AxisFactor.XAxis.DateTimeFormat = "dd";

sList.AxisFactor.XAxis.IsShowTick = false;
sList.AxisFactor.XAxis.IsVisibleFigures = false;
sList.GraphArea.Grid.IsBackGridColor = false;
sList.AxisFactor.YAxis.AxisMagin = 50;

sList.AxisFactor.YAxis.IsZeroStartScale = false;


sList.AxisFactor.XAxis.Interval = counts / 10;
sList2.AxisFactor.XAxis.Interval = counts / 10;

sList2.ChartType = ChartType.Column;

sList2.SeriesCollection[0].SeriesColor = Color.YellowGreen;

sList2.AxisFactor.XAxis.DataType = AxisDataType.DateTime;
sList2.AxisFactor.YAxis.Direction = AxisDirection.Right;
sList2.AxisFactor.XAxis.DateTimeLabelType = DateTimeLabelType.Day;
sList2.AxisFactor.XAxis.DateTimeFormat = "yy-MM-dd";

sList2.AxisFactor.YAxis.IsZeroStartScale = false;
sList2.GraphArea.Grid.IsBackGridColor = false;
sList2.AxisFactor.YAxis.AxisMagin = 50;



this.hHippoChart1.SeriesAreaRate = "6:2";
this.hHippoChart1.Designer.InnerBackColor = Color.FromArgb(214, 226, 239);
this.hHippoChart1.LegendBox.Visible = false;
this.hHippoChart1.SeriesListDictionary.Add(sList);
this.hHippoChart1.SeriesListDictionary.Add(sList2);
this.hHippoChart1.DrawChart();

AxisTick tk = new AxisTick(sList.SeriesCollection[0].items[sList.SeriesCollection[0].items.Count - 1].YValue);
tk.Label.Text = sList.SeriesCollection[0].items[sList.SeriesCollection[0].items.Count - 1].YValue.ToString() + "\r\n3.86%";
tk.BackColor = Color.Red;
tk.Label.ForeColor = Color.White;
sList.AxisFactor.YAxis.ExtraTicks.Add(tk);

AxisTick tkMax = new AxisTick(sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Max].Value);
tkMax.Label.Text = sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Max].Value.ToString();
tkMax.IsShowGridLine = true;
tkMax.GridLine.LineColor = Color.Red;
tkMax.GridLine.LineWidth = 1;
tkMax.GridLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
sList.AxisFactor.YAxis.ExtraTicks.Add(tkMax);

AxisTick tkMin = new AxisTick(sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Min].Value);
tkMin.Label.Text = sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Min].Value.ToString();
tkMin.Label.ForeColor = Color.Blue;
tkMin.IsShowGridLine = true;
tkMin.GridLine.LineColor = Color.Blue;
tkMin.GridLine.LineWidth = 1;
tkMin.GridLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
sList.AxisFactor.YAxis.ExtraTicks.Add(tkMin);

//AxisTick tk2 = new AxisTick(new PointF(0, this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.Y));
//tk2.IsShowGridLine = true;
//tk2.GridLine.LineColor = Color.Gray;
//tk2.GridLine.LineWidth = 1;
//sList.AxisFactor.XAxis.ExtraTicks.Add(tk2);

//AxisTick tk1 = new AxisTick(new PointF(this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.X, 0));
//tk1.IsShowGridLine = true;
//tk1.GridLine.LineColor = Color.Gray;
//tk1.GridLine.LineWidth = 1;
//sList.AxisFactor.YAxis.ExtraTicks.Add(tk1);


AxisTick tk33 = new AxisTick(sList2.SeriesCollection[0].items[sList2.SeriesCollection[0].items.Count - 1].YValue);
tk33.Label.Text = sList2.SeriesCollection[0].items[sList2.SeriesCollection[0].items.Count - 1].YValue.ToString();
tk33.BackColor = Color.Green;
tk33.Label.ForeColor = Color.White;
sList2.AxisFactor.YAxis.ExtraTicks.Add(tk33);


this.hHippoChart1.DrawChart();
}

private void Draw()
{
sList.AxisFactor.XAxis.Interval = counts / 10;
sList2.AxisFactor.XAxis.Interval = counts / 10;

sList.AxisFactor.YAxis.ExtraTicks[0].Label.Text = sList.SeriesCollection[0].items[0].YValue.ToString() + "\r\n3.86%";
sList.AxisFactor.YAxis.ExtraTicks[0].Value = sList.SeriesCollection[0].items[0].YValue;
sList.AxisFactor.YAxis.ExtraTicks[0].BackColor = sList.SeriesCollection[0].SeriesColor;

sList.AxisFactor.YAxis.ExtraTicks[1].Label.Text = sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Max].Value.ToString();
sList.AxisFactor.YAxis.ExtraTicks[1].Value = sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Max].Value;

sList.AxisFactor.YAxis.ExtraTicks[2].Label.Text = sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Min].Value.ToString();
sList.AxisFactor.YAxis.ExtraTicks[2].Value = sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Min].Value;

sList2.AxisFactor.YAxis.ExtraTicks[0].Label.Text = sList2.SeriesCollection[0].items[0].YValue.ToString();
sList2.AxisFactor.YAxis.ExtraTicks[0].Value = sList2.SeriesCollection[0].items[0].YValue;

this.hHippoChart1.DrawChart();
}

private void timer2_Tick(object sender, EventArgs e)
{
// 가상의 시리즈 아이템 주식 데이터 만들기



// 가상의 거래량 추가하기



}

private void hHippoChart1_ChartSizeChanged(object sender, EventArgs e)
{
this.hHippoChart1.DrawChart();
}

private void hHippoChart1_ChartMouseMove(object sender, MouseEventArgs e)
{
//if (this.hHippoChart1.SeriesListDictionary.Count > 0)
//{
// double zeroX = this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.X;
// double zeroY = this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.Y;

// double coodiRecHeight = this.hHippoChart1.Size.Height;

// float cX = (float)(zeroX + (e.X - this.hHippoChart1.SeriesListDictionary[0].GraphArea.LeftAxisRectangle.Width));
// float cY = (float)(zeroY - (coodiRecHeight - e.Y
// - this.hHippoChart1.SeriesListDictionary[0].GraphArea.BottomAxisRectangle.Height
// - this.hHippoChart1.SeriesListDictionary[0].Margin
// - Figures.LogoSpareEmpty - 10
// ));

// this.hHippoChart1.SeriesListDictionary[0].AxisFactor.XAxis.ExtraTicks[0].TickPoint = new PointF(cX, this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.Y);
// this.hHippoChart1.SeriesListDictionary[0].AxisFactor.YAxis.ExtraTicks[1].TickPoint = new PointF(this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.X, cY);

// this.hHippoChart1.DrawChart();
//}
}

private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{
try
{
sList.SeriesCollection[0].items.Clear();
sList2.SeriesCollection[0].items.Clear();

int newIDX = totalCount - 1 - e.NewValue;

for(int i = newIDX; i > newIDX - counts; i--)
{
sList.SeriesCollection[0].items.Add(items[i]);
sList2.SeriesCollection[0].items.Add(items2[i]);
}

Draw();
}
catch { }
}

// 예전데이터로
private void button1_Click(object sender, EventArgs e)
{
this.hScrollBar1.Value++;

if (this.hScrollBar1.Value > totalCount - 2) this.hScrollBar1.Value = totalCount - 1;

sList.SeriesCollection[0].items.Clear();
sList2.SeriesCollection[0].items.Clear();

int newIDX = totalCount - 1 - this.hScrollBar1.Value;

for(int i = newIDX; i > newIDX - counts; i--)
{
sList.SeriesCollection[0].items.Add(items[i]);
sList2.SeriesCollection[0].items.Add(items2[i]);
}

Draw();
}

// 최신
private void button2_Click(object sender, EventArgs e)
{
int idx = this.hScrollBar1.Value;

idx--;

if (idx < 0) idx = 0;

this.hScrollBar1.Value = idx;

sList.SeriesCollection[0].items.Clear();
sList2.SeriesCollection[0].items.Clear();

int newIDX = totalCount - 1 - this.hScrollBar1.Value;

for(int i = newIDX; i > newIDX - counts; i--)
{
sList.SeriesCollection[0].items.Add(items[i]);
sList2.SeriesCollection[0].items.Add(items2[i]);
}

Draw();
}

private void trackBar1_Scroll(object sender, EventArgs e)
{
this.hScrollBar1.Value = 0;

counts = this.trackBar1.Value;

sList.SeriesCollection[0].items.Clear();
sList2.SeriesCollection[0].items.Clear();

for(int i = totalCount - 1; i > totalCount - 1 - counts; i--)
{
sList.SeriesCollection[0].items.Add(items[i]);
sList2.SeriesCollection[0].items.Add(items2[i]);
}

Draw();
}

///
/// 일
///

///
///
private void button4_Click(object sender, EventArgs e)
{

}

///
/// 주
///

///
///
private void button5_Click(object sender, EventArgs e)
{

}

///
/// 월
///

///
///
private void button6_Click(object sender, EventArgs e)
{

}

///
/// 블랙 테마
///

///
///
private void panel2_Click(object sender, EventArgs e)
{
if (panel2.BackColor != Color.White)
{
sList.AxisFactor.BackColor = Color.FromArgb(61, 61, 61);

sList.AxisFactor.YAxis.Line.LineColor = Color.White;
sList.AxisFactor.XAxis.Line.LineColor = Color.White;
sList.AxisFactor.YAxis.ForeColor = Color.White;
sList.AxisFactor.XAxis.ForeColor = Color.White;

sList2.AxisFactor.BackColor = Color.FromArgb(61, 61, 61);

sList2.AxisFactor.YAxis.Line.LineColor = Color.White;
sList2.AxisFactor.XAxis.Line.LineColor = Color.White;
sList2.AxisFactor.YAxis.ForeColor = Color.White;
sList2.AxisFactor.XAxis.ForeColor = Color.White;

hHippoChart1.Designer.InnerBackColor = Color.FromArgb(61, 61, 61);

this.hHippoChart1.DrawChart();

panel1.BackColor = Color.FromArgb(49, 49, 49);
panel2.BackColor = Color.White;
}
else
{
Init();

panel1.BackColor = SystemColors.Control;
panel2.BackColor = Color.FromArgb(61, 61, 61);
}
}
}
}


VB
 

Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports Hippo
Imports Hippo.WindowsForm4

Namespace Hippo43StockHTSSample
Public Partial Class Form1
Inherits Form
Private sList As SeriesList
Private sList2 As SeriesList

Private items As SeriesItem()
Private items2 As SeriesItem()

` 총 데이터 수
Private totalCount As Integer = 1000

` 차트 한 화면에 보여줄 개수
Private counts As Integer = 100

Public Sub New()
InitializeComponent()

Figures.CoordinateXtextLimitEmpty = 0
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs)
timer1.Interval = 1000

Init()

`Draw();
End Sub

Private Sub Init()
sList = New SeriesList()
sList2 = New SeriesList()

sList.SeriesCollection.Add(New Series())
sList2.SeriesCollection.Add(New Series())

items = New SeriesItem(totalCount - 1) {}
items2 = New SeriesItem(totalCount - 1) {}

Dim R As New. Random()

For i As Integer = 1 To totalCount
Dim item As New. SeriesItem()
Dim item2 As New. SeriesItem()

item.XDateTimeValue = DateTime.Parse("2013-01-01").AddDays(i)
item2.XDateTimeValue = DateTime.Parse("2013-01-01").AddDays(i)

item.YStartValue = R.[Next](1000, 1050) * i - 11 * i
` 시가
item.LowValue = R.[Next](1000, 1050) * i - 12 * i
` 저가
item.YValue = R.[Next](1000, 1050) * i - 15 * i
` 종가
item.HighValue = R.[Next](1000, 1050) * i - 10 * i
` 고가
If i > 950 AndAlso i < 990 Then
item.YStartValue = R.[Next](950, 1000) * i - 33 * i
` 시가
item.LowValue = R.[Next](950, 1000) * i - 22 * i
` 저가
item.YValue = R.[Next](950, 1000) * i - 30 * i
` 종가
` 고가
item.HighValue = R.[Next](950, 1000) * i - 14 * i
End If

If i > 200 AndAlso i < 600 Then
item.YStartValue = R.[Next](1100, 1200) * i - 40 * i
` 시가
item.LowValue = R.[Next](1100, 1200) * i - 60 * i
` 저가
item.YValue = R.[Next](1100, 1200) * i - 30 * i
` 종가
` 고가
item.HighValue = R.[Next](1100, 1200) * i - 10 * i
End If


item2.YValue = R.[Next](10000, 20000)

items.SetValue(item, i - 1)
items2.SetValue(item2, i - 1)
Next


` 가장 뒤에 100 개를 먼저 그린다.

For i As Integer = totalCount - 1 To totalCount - 1 - counts + 1 Step -1
sList.SeriesCollection(0).items.Add(items(i))
sList2.SeriesCollection(0).items.Add(items2(i))
Next



sList.ChartType = ChartType.CandleStick
sList.AxisFactor.YAxis.Direction = AxisDirection.Right
sList.AxisFactor.XAxis.DataType = AxisDataType.DateTime
sList.AxisFactor.XAxis.DateTimeLabelType = DateTimeLabelType.Day
sList.AxisFactor.XAxis.DateTimeFormat = "dd"

sList.AxisFactor.XAxis.IsShowTick = False
sList.AxisFactor.XAxis.IsVisibleFigures = False
sList.GraphArea.Grid.IsBackGridColor = False
sList.AxisFactor.YAxis.AxisMagin = 50

sList.AxisFactor.YAxis.IsZeroStartScale = False


sList.AxisFactor.XAxis.Interval = counts / 10
sList2.AxisFactor.XAxis.Interval = counts / 10

sList2.ChartType = ChartType.Column

sList2.SeriesCollection(0).SeriesColor = Color.YellowGreen

sList2.AxisFactor.XAxis.DataType = AxisDataType.DateTime
sList2.AxisFactor.YAxis.Direction = AxisDirection.Right
sList2.AxisFactor.XAxis.DateTimeLabelType = DateTimeLabelType.Day
sList2.AxisFactor.XAxis.DateTimeFormat = "yy-MM-dd"

sList2.AxisFactor.YAxis.IsZeroStartScale = False
sList2.GraphArea.Grid.IsBackGridColor = False
sList2.AxisFactor.YAxis.AxisMagin = 50



Me.hHippoChart1.SeriesAreaRate = "6:2"
Me.hHippoChart1.Designer.InnerBackColor = Color.FromArgb(214, 226, 239)
Me.hHippoChart1.LegendBox.Visible = False
Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.SeriesListDictionary.Add(sList2)
Me.hHippoChart1.DrawChart()

Dim tk As New. AxisTick(sList.SeriesCollection(0).items(sList.SeriesCollection(0).items.Count - 1).YValue)
tk.Label.Text = sList.SeriesCollection(0).items(sList.SeriesCollection(0).items.Count - 1).YValue.ToString() + vbCr & vbLf & "3.86%"
tk.BackColor = Color.Red
tk.Label.ForeColor = Color.White
sList.AxisFactor.YAxis.ExtraTicks.Add(tk)

Dim tkMax As New. AxisTick(sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Max).Value)
tkMax.Label.Text = sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Max).Value.ToString()
tkMax.IsShowGridLine = True
tkMax.GridLine.LineColor = Color.Red
tkMax.GridLine.LineWidth = 1
tkMax.GridLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash
sList.AxisFactor.YAxis.ExtraTicks.Add(tkMax)

Dim tkMin As New. AxisTick(sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Min).Value)
tkMin.Label.Text = sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Min).Value.ToString()
tkMin.Label.ForeColor = Color.Blue
tkMin.IsShowGridLine = True
tkMin.GridLine.LineColor = Color.Blue
tkMin.GridLine.LineWidth = 1
tkMin.GridLine.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash
sList.AxisFactor.YAxis.ExtraTicks.Add(tkMin)

`AxisTick tk2 = new AxisTick(new PointF(0, this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.Y));
`tk2.IsShowGridLine = true;
`tk2.GridLine.LineColor = Color.Gray;
`tk2.GridLine.LineWidth = 1;
`sList.AxisFactor.XAxis.ExtraTicks.Add(tk2);

`AxisTick tk1 = new AxisTick(new PointF(this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.X, 0));
`tk1.IsShowGridLine = true;
`tk1.GridLine.LineColor = Color.Gray;
`tk1.GridLine.LineWidth = 1;
`sList.AxisFactor.YAxis.ExtraTicks.Add(tk1);


Dim tk33 As New. AxisTick(sList2.SeriesCollection(0).items(sList2.SeriesCollection(0).items.Count - 1).YValue)
tk33.Label.Text = sList2.SeriesCollection(0).items(sList2.SeriesCollection(0).items.Count - 1).YValue.ToString()
tk33.BackColor = Color.Green
tk33.Label.ForeColor = Color.White
sList2.AxisFactor.YAxis.ExtraTicks.Add(tk33)


Me.hHippoChart1.DrawChart()
End Sub

Private Sub Draw()
sList.AxisFactor.XAxis.Interval = counts / 10
sList2.AxisFactor.XAxis.Interval = counts / 10

sList.AxisFactor.YAxis.ExtraTicks(0).Label.Text = sList.SeriesCollection(0).items(0).YValue.ToString() + vbCr & vbLf & "3.86%"
sList.AxisFactor.YAxis.ExtraTicks(0).Value = sList.SeriesCollection(0).items(0).YValue
sList.AxisFactor.YAxis.ExtraTicks(0).BackColor = sList.SeriesCollection(0).SeriesColor

sList.AxisFactor.YAxis.ExtraTicks(1).Label.Text = sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Max).Value.ToString()
sList.AxisFactor.YAxis.ExtraTicks(1).Value = sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Max).Value

sList.AxisFactor.YAxis.ExtraTicks(2).Label.Text = sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Min).Value.ToString()
sList.AxisFactor.YAxis.ExtraTicks(2).Value = sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Min).Value

sList2.AxisFactor.YAxis.ExtraTicks(0).Label.Text = sList2.SeriesCollection(0).items(0).YValue.ToString()
sList2.AxisFactor.YAxis.ExtraTicks(0).Value = sList2.SeriesCollection(0).items(0).YValue

Me.hHippoChart1.DrawChart()
End Sub

Private Sub timer2_Tick(sender As Object, e As EventArgs)
` 가상의 시리즈 아이템 주식 데이터 만들기



` 가상의 거래량 추가하기



End Sub

Private Sub hHippoChart1_ChartSizeChanged(sender As Object, e As EventArgs)
Me.hHippoChart1.DrawChart()
End Sub

Private Sub hHippoChart1_ChartMouseMove(sender As Object, e As MouseEventArgs)
`if (this.hHippoChart1.SeriesListDictionary.Count > 0)
`{
` double zeroX = this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.X;
` double zeroY = this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.Y;

` double coodiRecHeight = this.hHippoChart1.Size.Height;

` float cX = (float)(zeroX + (e.X - this.hHippoChart1.SeriesListDictionary[0].GraphArea.LeftAxisRectangle.Width));
` float cY = (float)(zeroY - (coodiRecHeight - e.Y
` - this.hHippoChart1.SeriesListDictionary[0].GraphArea.BottomAxisRectangle.Height
` - this.hHippoChart1.SeriesListDictionary[0].Margin
` - Figures.LogoSpareEmpty - 10
` ));

` this.hHippoChart1.SeriesListDictionary[0].AxisFactor.XAxis.ExtraTicks[0].TickPoint = new PointF(cX, this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.Y);
` this.hHippoChart1.SeriesListDictionary[0].AxisFactor.YAxis.ExtraTicks[1].TickPoint = new PointF(this.hHippoChart1.SeriesListDictionary[0].AxisFactor.Zero.X, cY);

` this.hHippoChart1.DrawChart();
`}
End Sub

Private Sub hScrollBar1_Scroll(sender As Object, e As ScrollEventArgs)
Try
sList.SeriesCollection(0).items.Clear()
sList2.SeriesCollection(0).items.Clear()

Dim newIDX As Integer = totalCount - 1 - e.NewValue

For i As Integer = newIDX To newIDX - counts + 1 Step -1
sList.SeriesCollection(0).items.Add(items(i))
sList2.SeriesCollection(0).items.Add(items2(i))
Next

Draw()
Catch
End Try
End Sub

` 예전데이터로
Private Sub button1_Click(sender As Object, e As EventArgs)
Me.hScrollBar1.Value += 1

If Me.hScrollBar1.Value > totalCount - 2 Then
Me.hScrollBar1.Value = totalCount - 1
End If

sList.SeriesCollection(0).items.Clear()
sList2.SeriesCollection(0).items.Clear()

Dim newIDX As Integer = totalCount - 1 - Me.hScrollBar1.Value

For i As Integer = newIDX To newIDX - counts + 1 Step -1
sList.SeriesCollection(0).items.Add(items(i))
sList2.SeriesCollection(0).items.Add(items2(i))
Next

Draw()
End Sub

` 최신
Private Sub button2_Click(sender As Object, e As EventArgs)
Dim idx As Integer = Me.hScrollBar1.Value

idx -= 1

If idx < 0 Then
idx = 0
End If

Me.hScrollBar1.Value = idx

sList.SeriesCollection(0).items.Clear()
sList2.SeriesCollection(0).items.Clear()

Dim newIDX As Integer = totalCount - 1 - Me.hScrollBar1.Value

For i As Integer = newIDX To newIDX - counts + 1 Step -1
sList.SeriesCollection(0).items.Add(items(i))
sList2.SeriesCollection(0).items.Add(items2(i))
Next

Draw()
End Sub

Private Sub trackBar1_Scroll(sender As Object, e As EventArgs)
Me.hScrollBar1.Value = 0

counts = Me.trackBar1.Value

sList.SeriesCollection(0).items.Clear()
sList2.SeriesCollection(0).items.Clear()

For i As Integer = totalCount - 1 To totalCount - 1 - counts + 1 Step -1
sList.SeriesCollection(0).items.Add(items(i))
sList2.SeriesCollection(0).items.Add(items2(i))
Next

Draw()
End Sub

```
``` 일
```

```
```
Private Sub button4_Click(sender As Object, e As EventArgs)

End Sub

```
``` 주
```

```
```
Private Sub button5_Click(sender As Object, e As EventArgs)

End Sub

```
``` 월
```

```
```
Private Sub button6_Click(sender As Object, e As EventArgs)

End Sub

```
``` 블랙 테마
```

```
```
Private Sub panel2_Click(sender As Object, e As EventArgs)
If panel2.BackColor <> Color.White Then
sList.AxisFactor.BackColor = Color.FromArgb(61, 61, 61)

sList.AxisFactor.YAxis.Line.LineColor = Color.White
sList.AxisFactor.XAxis.Line.LineColor = Color.White
sList.AxisFactor.YAxis.ForeColor = Color.White
sList.AxisFactor.XAxis.ForeColor = Color.White

sList2.AxisFactor.BackColor = Color.FromArgb(61, 61, 61)

sList2.AxisFactor.YAxis.Line.LineColor = Color.White
sList2.AxisFactor.XAxis.Line.LineColor = Color.White
sList2.AxisFactor.YAxis.ForeColor = Color.White
sList2.AxisFactor.XAxis.ForeColor = Color.White

hHippoChart1.Designer.InnerBackColor = Color.FromArgb(61, 61, 61)

Me.hHippoChart1.DrawChart()

panel1.BackColor = Color.FromArgb(49, 49, 49)
panel2.BackColor = Color.White
Else
Init()

panel1.BackColor = SystemColors.Control
panel2.BackColor = Color.FromArgb(61, 61, 61)
End If
End Sub
End Class
End Namespace



※ 히포차트 샘플 코드는 버전별로 상이한 결과를 나타낼 수 있습니다.

이 코드 관련 문의 사항은 페이스북 리플을 달아주시거나 아래 이메일로 이 페이지 주소와 함께 문의주세요.

helpdesk@hippochart.com





Copyright © 2009-2018 HippoChart. Inc.  All Rights Reserved.