HippoEngine en = new HippoEngine();
en.DataType = DataSourceType.Excel;
en.Query = "select * from [Sheet1$]";
en.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=`C:\Users\neohippo\Dropbox\Projects\_Hippochart\Hippo 4.1\Hippo Chart 2010 4\HippoChartBeta\WindowsHippoTest\주식차트샘플2.xls`;Extended Properties=`Excel 12.0;HDR=YES`";
SeriesList sList = en.GetSeriesListOfStock(DataSourceType.Excel, "년/월", "시가", "종가", "저가", "고가");
sList.AxisFactor.AxisItems.Add(new Axis(AxisType.Ytype));
sList.AxisFactor.AxisItems[0].SetAxisStep(10000, 40000, 5000);
sList.AxisFactor.YAxis.Visible = false;
sList.ChartType = ChartType.CandleStick;
sList.SeriesCollection[0].Name = "주가 ";
sList.GraphArea.Grid.Interval = 10;
sList.AxisFactor.XAxis.Interval = 15;
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 (Highitem != null)
{
Highitem.Balloon = new Balloon();
Highitem.Balloon.BalloonType = BalloonType.Rectangle;
Highitem.Balloon.HeightType = HeightType.Bottom;
Highitem.Balloon.BackColor = Color.Transparent;
Highitem.Balloon.Label.Text = "최고가 : " + Highitem.HighValue.ToString();
Highitem.Balloon.IsShadow = false;
Highitem.Balloon.Label.ForeColor = Color.Blue;
Highitem.Balloon.Line.LineColor = Color.Transparent;
}
if (Lowitem != null)
{
Lowitem.Balloon = new Balloon();
Lowitem.Balloon.BalloonType = BalloonType.Rectangle;
Lowitem.Balloon.HeightType = HeightType.Bottom;
Lowitem.Balloon.BackColor = Color.Transparent;
Lowitem.Balloon.Label.Text = "최저가 : " + Highitem.LowValue.ToString();
Lowitem.Balloon.IsShadow = false;
Lowitem.Balloon.Label.ForeColor = Color.Red;
Lowitem.Balloon.Line.LineColor = Color.Transparent;
}
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 = "유상증자 ( 0.00% )";
Series sr2 = new Series();
sr2.Name = "Trend1";
sr2.ChartType = ChartType.AreaLine;
sr2.Points.Width = 0;
sr2.Transparency = 99;
sr2.Line.LineWidth = 2;
sr2.SeriesColor = Color.Yellow;
Regression rg = new Regression();
rg.XYCount = sList.SeriesCollection[0].items.Count;
rg.Degree(4);
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.Name = sList.SeriesCollection[0].items[i].Name;
item2.YValue = rg.Coeff(4) * Math.Pow(i, 4) + rg.Coeff(3) * Math.Pow(i, 3) + rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0);
item2.YStartValue = item2.YValue - 1500 * (new Random().Next(6));
sr2.items.Add(item2);
}
Series sr3 = new Series();
sr3.Name = "Trend2";
sr3.ChartType = ChartType.Line;
sr3.Line.LineWidth = 2;
sr3.Points.Width = 0;
rg = new Regression();
rg.XYCount = sList.SeriesCollection[0].items.Count;
rg.Degree(1);
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.Name = sList.SeriesCollection[0].items[i].Name;
item2.YValue = rg.Coeff(1) * i + rg.Coeff(0);
sr3.items.Add(item2);
}
sList.SeriesCollection.Add(sr2);
sList.SeriesCollection.Add(sr3);
sList.AxisFactor.AxisItems[0].Decimalpoint = 0;
AxisTick tk = new AxisTick(27670);
tk.Label.Font = new Font("굴림", 9, FontStyle.Regular);
tk.Label.Text = "25,670";
tk.BackColor = Color.Red;
tk.Label.ForeColor = Color.White;
sList.AxisFactor.AxisItems[0].ExtraTicks.Add(tk);
sList.SeriesCollection[0].AxisIndex = 1;
this.hHippoChart1.Designer.BackColor = Color.LightBlue;
this.hHippoChart1.Designer.BackLineColor = Color.SkyBlue;
this.hHippoChart1.Titles.Label.Text = "";
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 = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=`C:\Users\neohippo\Dropbox\Projects\_Hippochart\Hippo 4.1\Hippo Chart 2010 4\HippoChartBeta\WindowsHippoTest\주식차트샘플2.xls`;Extended Properties=`Excel 12.0;HDR=YES`"
Dim sList As SeriesList = en.GetSeriesListOfStock(DataSourceType.Excel, "년/월", "시가", "종가", "저가", "고가")
sList.AxisFactor.AxisItems.Add(New Axis(AxisType.Ytype))
sList.AxisFactor.AxisItems(0).SetAxisStep(10000, 40000, 5000)
sList.AxisFactor.YAxis.Visible = False
sList.ChartType = ChartType.CandleStick
sList.SeriesCollection(0).Name = "주가 "
sList.GraphArea.Grid.Interval = 10
sList.AxisFactor.XAxis.Interval = 15
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
Next
If Highitem IsNot Nothing Then
Highitem.Balloon = New Balloon()
Highitem.Balloon.BalloonType = BalloonType.Rectangle
Highitem.Balloon.HeightType = HeightType.Bottom
Highitem.Balloon.BackColor = Color.Transparent
Highitem.Balloon.Label.Text = "최고가 : " & Highitem.HighValue.ToString()
Highitem.Balloon.IsShadow = False
Highitem.Balloon.Label.ForeColor = Color.Blue
Highitem.Balloon.Line.LineColor = Color.Transparent
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.Transparent
Lowitem.Balloon.Label.Text = "최저가 : " & Highitem.LowValue.ToString()
Lowitem.Balloon.IsShadow = False
Lowitem.Balloon.Label.ForeColor = Color.Red
Lowitem.Balloon.Line.LineColor = Color.Transparent
End If
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 = "유상증자 ( 0.00% )"
Dim sr2 As New. Series()
sr2.Name = "Trend1"
sr2.ChartType = ChartType.AreaLine
sr2.Points.Width = 0
sr2.Transparency = 99
sr2.Line.LineWidth = 2
sr2.SeriesColor = Color.Yellow
Dim rg As New. Regression()
rg.XYCount = sList.SeriesCollection(0).items.Count
rg.Degree(4)
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.Name = sList.SeriesCollection(0).items(i).Name
item2.YValue = rg.Coeff(4) * Math.Pow(i, 4) + rg.Coeff(3) * Math.Pow(i, 3) + rg.Coeff(2) * Math.Pow(i, 2) + rg.Coeff(1) * i + rg.Coeff(0)
item2.YStartValue = item2.YValue - 1500 * (New Random().[Next](6))
sr2.items.Add(item2)
Next
Dim sr3 As New. Series()
sr3.Name = "Trend2"
sr3.ChartType = ChartType.Line
sr3.Line.LineWidth = 2
sr3.Points.Width = 0
rg = New Regression()
rg.XYCount = sList.SeriesCollection(0).items.Count
rg.Degree(1)
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.Name = sList.SeriesCollection(0).items(i).Name
item2.YValue = rg.Coeff(1) * i + rg.Coeff(0)
sr3.items.Add(item2)
Next
sList.SeriesCollection.Add(sr2)
sList.SeriesCollection.Add(sr3)
sList.AxisFactor.AxisItems(0).Decimalpoint = 0
Dim tk As New. AxisTick(27670)
tk.Label.Font = New Font("굴림", 9, FontStyle.Regular)
tk.Label.Text = "25,670"
tk.BackColor = Color.Red
tk.Label.ForeColor = Color.White
sList.AxisFactor.AxisItems(0).ExtraTicks.Add(tk)
sList.SeriesCollection(0).AxisIndex = 1
Me.hHippoChart1.Designer.BackColor = Color.LightBlue
Me.hHippoChart1.Designer.BackLineColor = Color.SkyBlue
Me.hHippoChart1.Titles.Label.Text = ""
Me.hHippoChart1.LegendBox.Visible = False
Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.DrawChart()