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

[히포차트 4.2] 영역마커, 라인마커 종합 샘플







그래프에 다양한 영역과 라인을 표시하는 마커기능 종합 샘플입니다. 마커를 사용하는 좋은 예로 참고하시면 되겠습니다.




영역마커 - 온도 위험 지역 표시  영역마커 - X 축 데이터 영역 표시  [히포차트 4.2] 영역마커, 라인마커 종합 샘플  


C#
 
this.hHippoChart1.SeriesListDictionary.Clear();


SeriesList sList = new SeriesList();
sList.ChartType = ChartType.Line;



sList.AxisFactor.YAxis.TitleLabel.Text = "American peoples";
sList.AxisFactor.XAxis.TitleLabel.Text = "Step Items";
sList.AxisFactor.YAxis.IsAxisVerticalRotate = true;
sList.AxisFactor.XAxis.Interval = 2;
sList.AxisFactor.XAxis.DataType = AxisDataType.Number;

sList.GraphArea.Grid.IsBackGridColor = false;


AxisArea mk = new AxisArea("", 5, 12);
mk.TextFormat.LineAlignment = StringAlignment.Far;
mk.TextFormat.Alignment = StringAlignment.Center;
mk.BackColor = Color.FromArgb(44, Color.Violet);
mk.BringToFront = true;
mk.LegendVisible = false;
mk.Label.Text = "Safe Area ";

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

AxisArea tk = new AxisArea("", -25, 25);
tk.BackColor = Color.FromArgb(44, Color.Green);
tk.TextFormat.Alignment = StringAlignment.Far;
sList.AxisFactor.YAxis.Areas.Add(tk);



AxisMarker mk2 = new AxisMarker("Optimization", -25);
mk2.Line.LineColor = Color.LightGreen;
mk2.Line.LineWidth = 2;
mk2.Label.ForeColor = Color.LightGreen;
mk2.BringToFront = true;
mk2.TextFormat.LineAlignment = StringAlignment.Far;
mk2.TextFormat.Alignment = StringAlignment.Near;

sList.AxisFactor.YAxis.Markers.Add(mk2);



AxisMarker mk3 = new AxisMarker("[Step A]", 13);
mk3.Line.LineColor = Color.Blue;
mk3.Label.ForeColor = Color.Blue;
mk3.TextFormat.Alignment = StringAlignment.Near;
mk3.TextFormat.LineAlignment = StringAlignment.Near;
mk3.TextFormat.FormatFlags = StringFormatFlags.DirectionVertical;
sList.AxisFactor.XAxis.Markers.Add(mk3);


AxisMarker mk4 = new AxisMarker("[Step B]", 17);
mk4.Line.LineColor = Color.Blue;
mk4.Label.ForeColor = Color.Blue;
mk4.TextFormat.Alignment = StringAlignment.Near;
mk4.TextFormat.LineAlignment = StringAlignment.Near;
mk4.TextFormat.FormatFlags = StringFormatFlags.DirectionVertical;
sList.AxisFactor.XAxis.Markers.Add(mk4);

sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Median].Visible = true;
sList.AxisFactor.YAxis.AnalysisItems[AnalysisCategory.Max].Visible = true;


Random r = new Random();
for(int i = 0; i < 2; i++)
{
Series sr = new Series();
sr.Name = "Serie" + i.ToString();
sr.Points.Width = 5;
sr.Line.LineWidth = 3;
sr.Points.PointType = PointType.FillRectangle;

if (i == 1)
{
//sr.SeriesColor = Color.Blue;
sr.Line.LineWidth = 5;
}

for(int x = 0; x < 20; x++)
{
SeriesItem item = new SeriesItem();
item.XValue = x;
item.YValue = Math.Pow(x, 2) - 22 * x + r.Next(50);

if (i == 1 && x > 13)
{
item.YValue = double.NaN;
}

sr.items.Add(item);
}

sList.SeriesCollection.Add(sr);
}

this.hHippoChart1.SeriesListDictionary.Add(sList);
this.hHippoChart1.DrawChart();


VB
 
Me.hHippoChart1.SeriesListDictionary.Clear()


Dim sList As New. SeriesList()
sList.ChartType = ChartType.Line



sList.AxisFactor.YAxis.TitleLabel.Text = "American peoples"
sList.AxisFactor.XAxis.TitleLabel.Text = "Step Items"
sList.AxisFactor.YAxis.IsAxisVerticalRotate = True
sList.AxisFactor.XAxis.Interval = 2
sList.AxisFactor.XAxis.DataType = AxisDataType.Number

sList.GraphArea.Grid.IsBackGridColor = False


Dim mk As New. AxisArea("", 5, 12)
mk.TextFormat.LineAlignment = StringAlignment.Far
mk.TextFormat.Alignment = StringAlignment.Center
mk.BackColor = Color.FromArgb(44, Color.Violet)
mk.BringToFront = True
mk.LegendVisible = False
mk.Label.Text = "Safe Area "

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

Dim tk As New. AxisArea("", -25, 25)
tk.BackColor = Color.FromArgb(44, Color.Green)
tk.TextFormat.Alignment = StringAlignment.Far
sList.AxisFactor.YAxis.Areas.Add(tk)



Dim mk2 As New. AxisMarker("Optimization", -25)
mk2.Line.LineColor = Color.LightGreen
mk2.Line.LineWidth = 2
mk2.Label.ForeColor = Color.LightGreen
mk2.BringToFront = True
mk2.TextFormat.LineAlignment = StringAlignment.Far
mk2.TextFormat.Alignment = StringAlignment.Near

sList.AxisFactor.YAxis.Markers.Add(mk2)



Dim mk3 As New. AxisMarker("[Step A]", 13)
mk3.Line.LineColor = Color.Blue
mk3.Label.ForeColor = Color.Blue
mk3.TextFormat.Alignment = StringAlignment.Near
mk3.TextFormat.LineAlignment = StringAlignment.Near
mk3.TextFormat.FormatFlags = StringFormatFlags.DirectionVertical
sList.AxisFactor.XAxis.Markers.Add(mk3)


Dim mk4 As New. AxisMarker("[Step B]", 17)
mk4.Line.LineColor = Color.Blue
mk4.Label.ForeColor = Color.Blue
mk4.TextFormat.Alignment = StringAlignment.Near
mk4.TextFormat.LineAlignment = StringAlignment.Near
mk4.TextFormat.FormatFlags = StringFormatFlags.DirectionVertical
sList.AxisFactor.XAxis.Markers.Add(mk4)

sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Median).Visible = True
sList.AxisFactor.YAxis.AnalysisItems(AnalysisCategory.Max).Visible = True


Dim r As New. Random()
For i As Integer = 0 To 1
Dim sr As New. Series()
sr.Name = "Serie" & i.ToString()
sr.Points.Width = 5
sr.Line.LineWidth = 3
sr.Points.PointType = PointType.FillRectangle

If i = 1 Then
`sr.SeriesColor = Color.Blue;
sr.Line.LineWidth = 5
End If

For x As Integer = 0 To 19
Dim item As New. SeriesItem()
item.XValue = x
item.YValue = Math.Pow(x, 2) - 22 * x + r.[Next](50)

If i = 1 AndAlso x > 13 Then
item.YValue = Double.NaN
End If

sr.items.Add(item)
Next

sList.SeriesCollection.Add(sr)
Next

Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.DrawChart()


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

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

helpdesk@hippochart.com





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