Random r = new Random();
// 원래 그래프
SeriesList sListOrigin = new SeriesList();
sListOrigin.AxisFactor.XAxis.DataType = AxisDataType.Number;
sListOrigin.GraphArea.Grid.IsBackGridColor = false;
sListOrigin.GraphArea.Grid.GridDirection = GridDirection.Vertical;
sListOrigin.AxisFactor.YAxis.SetAxisStep(-60, 140, 20);
sListOrigin.AxisFactor.XAxis.SetAxisStep(0, 1000, 100);
Series sr = new Series();
for(double x = 0; x <= 1000; x += 0.1)
{
SeriesItem item = new SeriesItem();
item.XValue = x;
item.YValue = 20 * Math.Log(x);
sr.items.Add(item);
}
sListOrigin.SeriesCollection.Add(sr);
// 로그 스케일 적용
SeriesList sList = new SeriesList();
sList.AxisFactor.XAxis.DataType = AxisDataType.Number;
sList.GraphArea.Grid.IsBackGridColor = false;
sList.GraphArea.Grid.GridDirection = GridDirection.Vertical;
sList.AxisFactor.YAxis.SetAxisStep(-60, 140, 20);
sList.AxisFactor.XAxis.SetAxisStep(1, 5, 1);
sList.AxisFactor.XAxis.Ticks.Add(new AxisTick("0.1", "10^-1"));
sList.AxisFactor.XAxis.Ticks.Add(new AxisTick("1", "10^1"));
sList.AxisFactor.XAxis.Ticks.Add(new AxisTick("2", "10^2"));
sList.AxisFactor.XAxis.Ticks.Add(new AxisTick("3", "10^3"));
sList.AxisFactor.XAxis.Ticks.Add(new AxisTick("4", "10^4"));
sList.AxisFactor.XAxis.Ticks.Add(new AxisTick("5", "10^5"));
sList.AxisFactor.XAxis.Ticks[0].Label.ForeColor = Color.Black;
sList.AxisFactor.XAxis.Ticks[1].Label.ForeColor = Color.Black;
sList.AxisFactor.XAxis.Ticks[2].Label.ForeColor = Color.Black;
sList.AxisFactor.XAxis.Ticks[3].Label.ForeColor = Color.Black;
sList.AxisFactor.XAxis.Ticks[4].Label.ForeColor = Color.Black;
sList.AxisFactor.XAxis.Ticks[5].Label.ForeColor = Color.Black;
Series sr_log = new Series();
for(double x = 0; x <= 1000; x += 0.1)
{
SeriesItem item_log = new SeriesItem();
item_log.XValue = Math.Log(x);
item_log.YValue = 20 * Math.Log(x);
sr_log.items.Add(item_log);
}
// 로그스케일 눈금 처리
for(int z = 1; z < 5; z++)
{
int s_su = (int)(Math.Pow(10, z));
int e_su = (int)(Math.Pow(10, z + 1) - s_su);
for(int y = s_su; y <= e_su; y = y + s_su)
{
AxisTick tk = new AxisTick(Math.Log10(y));
tk.IsShowGridLine = true;
tk.GridLine.LineColor = Color.LightGray;
tk.GridLine.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
sList.AxisFactor.XAxis.ExtraTicks.Add(tk);
}
}
sList.SeriesCollection.Add(sr_log);
sList.Margin = 20;
sListOrigin.Margin = 20;
this.hHippoChart1.Logo.Label.Text = "www.hippochart.com";
this.hHippoChart1.Titles.Label.Text = "Hippochart Log Scale chart sample";
this.hHippoChart1.Designer.InnerBackColor = Color.WhiteSmoke;
this.hHippoChart1.Direction = GraphAreaLocation.Horizontal;
this.hHippoChart1.LegendBox.Visible = false;
this.hHippoChart1.SeriesListDictionary.Add(sListOrigin);
this.hHippoChart1.SeriesListDictionary.Add(sList);
this.hHippoChart1.DrawChart();
Dim r As New. Random()
` 원래 그래프
Dim sListOrigin As New. SeriesList()
sListOrigin.AxisFactor.XAxis.DataType = AxisDataType.Number
sListOrigin.GraphArea.Grid.IsBackGridColor = False
sListOrigin.GraphArea.Grid.GridDirection = GridDirection.Vertical
sListOrigin.AxisFactor.YAxis.SetAxisStep(-60, 140, 20)
sListOrigin.AxisFactor.XAxis.SetAxisStep(0, 1000, 100)
Dim sr As New. Series()
Dim x As Double = 0
While x <= 1000
Dim item As New. SeriesItem()
item.XValue = x
item.YValue = 20 * Math.Log(x)
sr.items.Add(item)
x += 0.1
End While
sListOrigin.SeriesCollection.Add(sr)
` 로그 스케일 적용
Dim sList As New. SeriesList()
sList.AxisFactor.XAxis.DataType = AxisDataType.Number
sList.GraphArea.Grid.IsBackGridColor = False
sList.GraphArea.Grid.GridDirection = GridDirection.Vertical
sList.AxisFactor.YAxis.SetAxisStep(-60, 140, 20)
sList.AxisFactor.XAxis.SetAxisStep(1, 5, 1)
sList.AxisFactor.XAxis.Ticks.Add(New AxisTick("0.1", "10^-1"))
sList.AxisFactor.XAxis.Ticks.Add(New AxisTick("1", "10^1"))
sList.AxisFactor.XAxis.Ticks.Add(New AxisTick("2", "10^2"))
sList.AxisFactor.XAxis.Ticks.Add(New AxisTick("3", "10^3"))
sList.AxisFactor.XAxis.Ticks.Add(New AxisTick("4", "10^4"))
sList.AxisFactor.XAxis.Ticks.Add(New AxisTick("5", "10^5"))
sList.AxisFactor.XAxis.Ticks(0).Label.ForeColor = Color.Black
sList.AxisFactor.XAxis.Ticks(1).Label.ForeColor = Color.Black
sList.AxisFactor.XAxis.Ticks(2).Label.ForeColor = Color.Black
sList.AxisFactor.XAxis.Ticks(3).Label.ForeColor = Color.Black
sList.AxisFactor.XAxis.Ticks(4).Label.ForeColor = Color.Black
sList.AxisFactor.XAxis.Ticks(5).Label.ForeColor = Color.Black
Dim sr_log As New. Series()
Dim x As Double = 0
While x <= 1000
Dim item_log As New. SeriesItem()
item_log.XValue = Math.Log(x)
item_log.YValue = 20 * Math.Log(x)
sr_log.items.Add(item_log)
x += 0.1
End While
` 로그스케일 눈금 처리
For z As Integer = 1 To 4
Dim s_su As Integer = CInt(Math.Pow(10, z))
Dim e_su As Integer = CInt(Math.Pow(10, z + 1) - s_su)
Dim y As Integer = s_su
While y <= e_su
Dim tk As New. AxisTick(Math.Log10(y))
tk.IsShowGridLine = True
tk.GridLine.LineColor = Color.LightGray
tk.GridLine.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot
sList.AxisFactor.XAxis.ExtraTicks.Add(tk)
y = y + s_su
End While
Next
sList.SeriesCollection.Add(sr_log)
sList.Margin = 20
sListOrigin.Margin = 20
Me.hHippoChart1.Logo.Label.Text = "www.hippochart.com"
Me.hHippoChart1.Titles.Label.Text = "Hippochart Log Scale chart sample"
Me.hHippoChart1.Designer.InnerBackColor = Color.WhiteSmoke
Me.hHippoChart1.Direction = GraphAreaLocation.Horizontal
Me.hHippoChart1.LegendBox.Visible = False
Me.hHippoChart1.SeriesListDictionary.Add(sListOrigin)
Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.DrawChart()