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

혼합형 차트 - 주식차트, 막대, 라인







주식차트와 막대, 라인 차트들 공간 비율에 맞게 사용자 정의하고 Y축 공간을 일치 시켜 그려본 혼합형(멀티 시리즈리스트) 차트




Mixed chart - line, column, linearea  Mixed chart - Pie, Linearea  Mixed chart - column, pylamid, gauge  혼합형 차트 - 주식차트, 막대, 라인  라인, 막대 일반 혼합형 차트  [히포차트 4.2] 게이지차트를 시리즈 레벨에서 그려보자  [히포차트 4.2] 일반게이지와 라인 차트의 혼합형 샘플  


C#
 
HippoEngine en = new HippoEngine();
en.DataType = DataSourceType.Excel;
en.Query = " select * from [자료2$] ";
en.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\MY Docu\stock34.xls;Extended Properties=Excel 12.0;HDR=YES";

SeriesList sList = en.GetSeriesListOfStock(DataSourceType.Excel, "년/월", "시가", "종가", "저가", "고가");

sList.ChartType = ChartType.Stock;

sList.SeriesCollection[0].Name = "주가";

sList.GraphArea.Grid.Interval = 10;
sList.GraphArea.Grid.GridDirection = GridDirection.Vertical;

sList.AxisFactor.XAxis.LabelFormat.FormatFlags = StringFormatFlags.DirectionVertical;
sList.AxisFactor.XAxis.Interval = 10;

sList.AxisFactor.XAxis.IsVisibleFigures = false;
sList.AxisFactor.XAxis.IsShowTick = false;

sList.AxisFactor.YAxis.SetAxisStep(10000, 40000, 5000);

AxisArea mk = new AxisArea("", 5, 22);
mk.TextFormat.LineAlignment = StringAlignment.Near;
mk.BackColor = Color.FromArgb(20, Color.Violet);

sList.AxisFactor.XAxis.Areas.Add(mk);




SeriesList sList2 = new SeriesList();
sList2.ChartType = ChartType.Column;

Random r = new Random();
for(int i = 0; i < 1; i++)
{
Series sr = new Series();
sr.SeriesColor = Color.YellowGreen;

for(int x = 0; x < 300; x++)
{
SeriesItem item = new SeriesItem();
item.Name = x.ToString();
item.YValue = r.Next(92320);

if (x > 100 && x < 172)
{
item.ItemColor = Color.Red;
}

sr.items.Add(item);
}
sList2.SeriesCollection.Add(sr);
}



SeriesList sList3= new SeriesList();
sList3.ChartType = ChartType.Spline;

for(int i = 0; i < 1; i++)
{
Series sr = new Series();

for(int x = 0; x < 25; x++)
{
SeriesItem item = new SeriesItem();
item.Name = x.ToString();
item.YValue = r.Next(92320);

sr.items.Add(item);
}
sList3.SeriesCollection.Add(sr);
}

sList.AxisFactor.YAxis.AxisMagin = 30;
sList2.AxisFactor.YAxis.AxisMagin = 30;
sList3.AxisFactor.YAxis.AxisMagin = 30;


this.hHippoChart1.Direction = GraphAreaLocation.Vertical;
this.hHippoChart1.DesignType = ChartDesignType.Simple;
this.hHippoChart1.Titles.Label.ForeColor = Color.SteelBlue;

this.hHippoChart1.LegendBox.Visible = false;
this.hHippoChart1.SeriesListDictionary.Add(sList);
this.hHippoChart1.SeriesListDictionary.Add(sList2);
this.hHippoChart1.SeriesListDictionary.Add(sList3);

this.hHippoChart1.SeriesAreaRate = "3: 2: 2";

this.hHippoChart1.DrawChart();


VB
 
Dim en As New. HippoEngine()
en.DataType = DataSourceType.Excel
en.Query = " select * from [자료2$] "
en.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\MY Docu\stock34.xls;Extended Properties=Excel 12.0;HDR=YES"

Dim sList As SeriesList = en.GetSeriesListOfStock(DataSourceType.Excel, "년/월", "시가", "종가", "저가", "고가")

sList.ChartType = ChartType.Stock

sList.SeriesCollection(0).Name = "주가"

sList.GraphArea.Grid.Interval = 10
sList.GraphArea.Grid.GridDirection = GridDirection.Vertical

sList.AxisFactor.XAxis.LabelFormat.FormatFlags = StringFormatFlags.DirectionVertical
sList.AxisFactor.XAxis.Interval = 10

sList.AxisFactor.XAxis.IsVisibleFigures = False
sList.AxisFactor.XAxis.IsShowTick = False

sList.AxisFactor.YAxis.SetAxisStep(10000, 40000, 5000)

Dim mk As New. AxisArea("", 5, 22)
mk.TextFormat.LineAlignment = StringAlignment.Near
mk.BackColor = Color.FromArgb(20, Color.Violet)

sList.AxisFactor.XAxis.Areas.Add(mk)




Dim sList2 As New. SeriesList()
sList2.ChartType = ChartType.Column

Dim r As New. Random()
For i As Integer = 0 To 0
Dim sr As New. Series()
sr.SeriesColor = Color.YellowGreen

For x As Integer = 0 To 299
Dim item As New. SeriesItem()
item.Name = x.ToString()
item.YValue = r.[Next](92320)

If x > 100 AndAlso x < 172 Then
item.ItemColor = Color.Red
End If

sr.items.Add(item)
Next
sList2.SeriesCollection.Add(sr)
Next



Dim sList3 As New. SeriesList()
sList3.ChartType = ChartType.Spline

For i As Integer = 0 To 0
Dim sr As New. Series()

For x As Integer = 0 To 24
Dim item As New. SeriesItem()
item.Name = x.ToString()
item.YValue = r.[Next](92320)

sr.items.Add(item)
Next
sList3.SeriesCollection.Add(sr)
Next

sList.AxisFactor.YAxis.AxisMagin = 30
sList2.AxisFactor.YAxis.AxisMagin = 30
sList3.AxisFactor.YAxis.AxisMagin = 30


Me.hHippoChart1.Direction = GraphAreaLocation.Vertical
Me.hHippoChart1.DesignType = ChartDesignType.Simple
Me.hHippoChart1.Titles.Label.ForeColor = Color.SteelBlue

Me.hHippoChart1.LegendBox.Visible = False
Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.SeriesListDictionary.Add(sList2)
Me.hHippoChart1.SeriesListDictionary.Add(sList3)

Me.hHippoChart1.SeriesAreaRate = "3: 2: 2"

Me.hHippoChart1.DrawChart()



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

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

helpdesk@hippochart.com





Copyright © 2009-2018 투데이트레이딩. Inc.  All Rights Reserved.