HippoEngine en = new HippoEngine();
en.DataType = DataSourceType.Excel;
en.Query = "select * from [Sheet1$]";
en.ConnectionString = "커넥션 정보";
SeriesList sList = en.GetSeriesListOfStock(DataSourceType.Excel, "년/월", "시가", "종가", "저가", "고가");
sList.ChartType = ChartType.CandleStick;
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.YAxis.SetAxisStep(10000, 40000, 5000);
double tempMaxHighval = double.MinValue;
double tempMaxLowval = double.MaxValue;
SeriesItem Highitem = new SeriesItem();
SeriesItem Lowitem = new SeriesItem();
foreach(SeriesItem item in sList.SeriesCollection[0].items)
{
if (item.HighValue > tempMaxHighval)
{
tempMaxHighval = item.HighValue;
Highitem = item;
}
if (item.LowValue < tempMaxLowval)
{
tempMaxLowval = item.LowValue;
Lowitem = item;
}
if (item.IsDojiType)
{
}
}
if (Highitem != null)
{
Highitem.Balloon = new Balloon();
Highitem.Balloon.BalloonType = BalloonType.Rectangle;
Highitem.Balloon.HeightType = HeightType.Bottom;
Highitem.Balloon.BackColor = Color.White;
Highitem.Balloon.Label.Text = "최고가 : " + Highitem.HighValue.ToString();
}
if (Lowitem != null)
{
Lowitem.Balloon = new Balloon();
Lowitem.Balloon.BalloonType = BalloonType.Rectangle;
Lowitem.Balloon.HeightType = HeightType.Bottom;
Lowitem.Balloon.BackColor = Color.White;
Lowitem.Balloon.Label.Text = "최저가 : " + Highitem.LowValue.ToString();
}
sList.AxisFactor.XAxis.UnitPixel = 22;
sList.SeriesCollection[0].items[11].Balloon = new Balloon();
sList.SeriesCollection[0].items[11].Balloon.BalloonType = BalloonType.Rectangle;
sList.SeriesCollection[0].items[11].Balloon.BackColor = Color.White;
sList.SeriesCollection[0].items[11].Balloon.HeightType = HeightType.Bottom;
sList.SeriesCollection[0].items[11].Balloon.Label.Text = "\r\n ---주식 시세 정보---\r\n";
sList.SeriesCollection[0].items[11].Balloon.Label.Text += "\r\n - 시가: " + sList.SeriesCollection[0].items[11].YStartValue.ToString("n0");
sList.SeriesCollection[0].items[11].Balloon.Label.Text += "\r\n - 종가: " + sList.SeriesCollection[0].items[11].YValue.ToString("n0");
sList.SeriesCollection[0].items[11].Balloon.Label.Text += "\r\n - 저가: " + sList.SeriesCollection[0].items[11].LowValue.ToString("n0");
sList.SeriesCollection[0].items[11].Balloon.Label.Text += "\r\n - 고가: " + sList.SeriesCollection[0].items[11].HighValue.ToString("n0");
sList.SeriesCollection[0].items[11].Balloon.Label.Text += "\r\n";
Series sr2 = new Series();
sr2.Name = "Trend1";
sr2.ChartType = ChartType.Line;
Regression rg = new Regression();
rg.XYCount = sList.SeriesCollection[0].items.Count;
rg.Degree(3);
int count = 0;
foreach(SeriesItem item in sList.SeriesCollection[0].items)
{
rg.XYAdd(count, item.YValue);
count++;
}
for(int j = 0; j < 1000; j++)
{
rg.RegVal(j);
}
for(int i = 0; i < sList.SeriesCollection[0].items.Count; i++)
{
SeriesItem item2 = new SeriesItem();
item2.YValue = rg.Coeff(3) * Math.Pow(i, 3) + rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0);
//item2.YValue = rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0);
//item2.YValue = rg.Coeff(1) * i + rg.Coeff(0);
sr2.items.Add(item2);
}
Series sr3 = new Series();
sr3.Name = "Trend2";
sr3.ChartType = ChartType.Line;
rg = new Regression();
rg.XYCount = sList.SeriesCollection[0].items.Count;
rg.Degree(3);
count = 0;
foreach(SeriesItem item in sList.SeriesCollection[0].items)
{
rg.XYAdd(count, item.HighValue);
count++;
}
for(int j = 0; j < 1000; j++)
{
rg.RegVal(j);
}
for(int i = 0; i < sList.SeriesCollection[0].items.Count; i++)
{
SeriesItem item2 = new SeriesItem();
item2.YValue = rg.Coeff(3) * Math.Pow(i, 3) + rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0);
//item2.YValue = rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0);
//item2.YValue = rg.Coeff(1) * i + rg.Coeff(0);
sr3.items.Add(item2);
}
sList.SeriesCollection.Add(sr2);
sList.SeriesCollection.Add(sr3);
this.hHippoChart1.LegendBox.Visible = false;
this.hHippoChart1.SeriesListDictionary.Add(sList);
this.hHippoChart1.DrawChart();
Dim en As New. HippoEngine()
en.DataType = DataSourceType.Excel
en.Query = "select * from [Sheet1$]"
en.ConnectionString = "커넥션정보"
Dim sList As SeriesList = en.GetSeriesListOfStock(DataSourceType.Excel, "년/월", "시가", "종가", "저가", "고가")
sList.ChartType = ChartType.CandleStick
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.YAxis.SetAxisStep(10000, 40000, 5000)
Dim tempMaxHighval As Double = Double.MinValue
Dim tempMaxLowval As Double = Double.MaxValue
Dim Highitem As New. SeriesItem()
Dim Lowitem As New. SeriesItem()
For Each item As SeriesItem In sList.SeriesCollection(0).items
If item.HighValue > tempMaxHighval Then
tempMaxHighval = item.HighValue
Highitem = item
End If
If item.LowValue < tempMaxLowval Then
tempMaxLowval = item.LowValue
Lowitem = item
End If
If item.IsDojiType Then
End If
Next
If Highitem IsNot Nothing Then
Highitem.Balloon = New Balloon()
Highitem.Balloon.BalloonType = BalloonType.Rectangle
Highitem.Balloon.HeightType = HeightType.Bottom
Highitem.Balloon.BackColor = Color.White
Highitem.Balloon.Label.Text = "최고가 : " & Highitem.HighValue.ToString()
End If
If Lowitem IsNot Nothing Then
Lowitem.Balloon = New Balloon()
Lowitem.Balloon.BalloonType = BalloonType.Rectangle
Lowitem.Balloon.HeightType = HeightType.Bottom
Lowitem.Balloon.BackColor = Color.White
Lowitem.Balloon.Label.Text = "최저가 : " & Highitem.LowValue.ToString()
End If
sList.AxisFactor.XAxis.UnitPixel = 22
sList.SeriesCollection(0).items(11).Balloon = New Balloon()
sList.SeriesCollection(0).items(11).Balloon.BalloonType = BalloonType.Rectangle
sList.SeriesCollection(0).items(11).Balloon.BackColor = Color.White
sList.SeriesCollection(0).items(11).Balloon.HeightType = HeightType.Bottom
sList.SeriesCollection(0).items(11).Balloon.Label.Text = vbCr & vbLf & " ---주식 시세 정보---" & vbCr & vbLf
sList.SeriesCollection(0).items(11).Balloon.Label.Text += vbCr & vbLf & " - 시가: " & sList.SeriesCollection(0).items(11).YStartValue.ToString("n0")
sList.SeriesCollection(0).items(11).Balloon.Label.Text += vbCr & vbLf & " - 종가: " & sList.SeriesCollection(0).items(11).YValue.ToString("n0")
sList.SeriesCollection(0).items(11).Balloon.Label.Text += vbCr & vbLf & " - 저가: " & sList.SeriesCollection(0).items(11).LowValue.ToString("n0")
sList.SeriesCollection(0).items(11).Balloon.Label.Text += vbCr & vbLf & " - 고가: " & sList.SeriesCollection(0).items(11).HighValue.ToString("n0")
sList.SeriesCollection(0).items(11).Balloon.Label.Text += vbCr & vbLf
Dim sr2 As New. Series()
sr2.Name = "Trend1"
sr2.ChartType = ChartType.Line
Dim rg As New. Regression()
rg.XYCount = sList.SeriesCollection(0).items.Count
rg.Degree(3)
Dim count As Integer = 0
For Each item As SeriesItem In sList.SeriesCollection(0).items
rg.XYAdd(count, item.YValue)
count += 1
Next
For j As Integer = 0 To 999
rg.RegVal(j)
Next
For i As Integer = 0 To sList.SeriesCollection(0).items.Count - 1
Dim item2 As New. SeriesItem()
item2.YValue = rg.Coeff(3) * Math.Pow(i, 3) + rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0)
`item2.YValue = rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0);
`item2.YValue = rg.Coeff(1) * i + rg.Coeff(0);
sr2.items.Add(item2)
Next
Dim sr3 As New. Series()
sr3.Name = "Trend2"
sr3.ChartType = ChartType.Line
rg = New Regression()
rg.XYCount = sList.SeriesCollection(0).items.Count
rg.Degree(3)
count = 0
For Each item As SeriesItem In sList.SeriesCollection(0).items
rg.XYAdd(count, item.HighValue)
count += 1
Next
For j As Integer = 0 To 999
rg.RegVal(j)
Next
For i As Integer = 0 To sList.SeriesCollection(0).items.Count - 1
Dim item2 As New. SeriesItem()
item2.YValue = rg.Coeff(3) * Math.Pow(i, 3) + rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0)
`item2.YValue = rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0);
`item2.YValue = rg.Coeff(1) * i + rg.Coeff(0);
sr3.items.Add(item2)
Next
sList.SeriesCollection.Add(sr2)
sList.SeriesCollection.Add(sr3)
Me.hHippoChart1.LegendBox.Visible = False
Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.DrawChart()