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

히포차트 4.3 - 배경색, 테마, 그라데이션 적용하기 (Tip 포함)







히포차트 4.3 버전으로 제작해본 샘플 대쉬보드 프로그램입니다.

검은색 테마로 작성되었으며 새로운 파이와 새로운 영역라인 차트 등 많은 정보가 담긴 복합 샘플 코드입니다.

폼에 3개의 차트를 생성하여 그림과 같이 배치한 후 샘플 코드를 붙여넣기 하셔서 테스트하시면 됩니다.

어플리케이션에 맞는 디자인을 위한 테마 설정 방법에 대해 알아볼 수 있습니다.




히포차트 테마 적용하기 - Black  그리드 배경 제거, 그리드색상, 축 라벨 색상, 축 라인 색상 등 테마 만들기  히포차트 4.3 - 배경색, 테마, 그라데이션 적용하기 (Tip 포함)  


C#
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Hippo;
using Hippo.WindowsForm4;

namespace WindowsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}

private void Form2_Load(object sender, EventArgs e)
{
SeriesList sList = new SeriesList();
sList.ChartType = ChartType.Line;
sList.AxisFactor.XAxis.DataType = AxisDataType.Number;

sList.AxisFactor.YAxis.Direction = AxisDirection.Right;

sList.AxisFactor.BackColor = Color.Transparent;

sList.AxisFactor.YAxis.Line.LineColor = Color.White;
sList.AxisFactor.XAxis.Line.LineColor = Color.White;
sList.AxisFactor.YAxis.ForeColor = Color.White;
sList.AxisFactor.XAxis.ForeColor = Color.White;

sList.Legend.Visible = true;
sList.Legend.BackColor = Color.FromArgb(50, Color.White);
sList.Legend.Header.NameLabel.Text = "Samung electronics Finance data (1997)dsdsd";

AxisTick tk = new AxisTick(22100);
tk.Label.Text = "22,100\r\n3.86%";
tk.BackColor = Color.Orange;
tk.IsShowGridLine = true;
tk.GridLine.LineColor = Color.Orange;
tk.Label.ForeColor = Color.White;
sList.AxisFactor.YAxis.ExtraTicks.Add(tk);

sList.Description.Label.Text = "SEOUL, April 29 - Samsung Electronics Co Ltd on Wednesday said it expects earnings to rise in the second quarter after posting its highest profit in three quarters in January-March, boosted by strong demand for its new Galaxy S6 flagship smartphones.";
sList.Description.Label.ForeColor = Color.White;
sList.Description.XDirection = AxisDirection.Right;
sList.Description.YDirection = AxisDirection.Top;

Random r = new Random();
for(int i = 0; i < 1; i++)
{
Series sr = new Series();
sr.Points.Width = 0;
sr.SeriesColor = Color.White;
sr.ForeColor = Color.White;
sr.Name = "Samung electronics Finance data (1997)";

sr.AreaType = AreaType.LineArea;
sr.Line.LineAreaColors = new Color[] { Color.FromArgb(13, 95, 119), Color.FromArgb(100, 13, 95, 119), Color.FromArgb(80, 13, 95, 119), Color.FromArgb(50, 13, 95, 119) };
sr.Line.AreaDesignType = AreaDesignType.Gradation;
sr.Line.LineWidth = 4;

for(int x = 0; x < 100; x++)
{
SeriesItem item = new SeriesItem();
item.XValue = x;
item.YValue = r.Next(50, 300) * x;

sr.items.Add(item);
}

sList.SeriesCollection.Add(sr);
}

this.hHippoChart1.Designer.InnerBackColor = Color.Black;
this.hHippoChart1.SeriesListDictionary.Add(sList);
this.hHippoChart1.DrawChart();


Draw2();
Draw3();
}

private void Draw2()
{
SeriesList sList = new SeriesList();
sList.ChartType = ChartType.Pie;
sList.Margin = 35;

Random r = new Random();
for(int i = 0; i < 1; i++)
{
Series sr = new Series();
sr.UnAxisFactor.TextLocation = UnAxisFigureTextLocation.Outer;
sr.UnAxisFactor.UnAxisDisplayItemType = UnAxisDisplayItemType.Figure_Name;
sr.UnAxisFactor.Pie3DDepth = 5;
sr.UnAxisFactor.PieTypes = PieType.TwoDemention;

for(int x = 0; x < 5; x++)
{
SeriesItem item = new SeriesItem();
item.Name = "item" + x.ToString();
item.YValue = r.Next(90);
item.IsShowFigureText = true;

item.Label = new Hippo.Label();
item.Label.ForeColor = Color.White;
item.Label.Font = new Font("굴림", 9, FontStyle.Bold);

sr.items.Add(item);
}
sList.SeriesCollection.Add(sr);
}
this.hHippoChart2.Designer.InnerBackColor = Color.Black;
this.hHippoChart2.SeriesListDictionary.Add(sList);
this.hHippoChart2.DrawChart();
}

private void Draw3()
{
SeriesList sList = new SeriesList();
sList.ChartType = ChartType.Column;

sList.AxisFactor.BackColor = Color.Transparent;

sList.AxisFactor.YAxis.Line.LineColor = Color.White;
sList.AxisFactor.XAxis.Line.LineColor = Color.White;
sList.AxisFactor.YAxis.ForeColor = Color.White;
sList.AxisFactor.XAxis.ForeColor = Color.White;

sList.Legend.Visible = true;
sList.Legend.Label.ForeColor = Color.White;

Random r = new Random();
for(int i = 0; i < 3; i++)
{
Series sr = new Series();
sr.Name = "Series" + i.ToString();
sr.ForeColor = Color.White;

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

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

this.hHippoChart3.Designer.InnerBackColor = Color.Black;
this.hHippoChart3.SeriesListDictionary.Add(sList);
this.hHippoChart3.DrawChart();
}

private void hHippoChart1_ChartSizeChanged(object sender, EventArgs e)
{
this.hHippoChart1.DrawChart();
}

private void hHippoChart2_ChartSizeChanged(object sender, EventArgs e)
{
this.hHippoChart2.DrawChart();
}

private void hHippoChart3_ChartSizeChanged(object sender, EventArgs e)
{
this.hHippoChart3.DrawChart();
}

private void hScrollBar1_Scroll(object sender, ScrollEventArgs e)
{

}
}
}


VB
 

Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports Hippo
Imports Hippo.WindowsForm4

Namespace WindowsApplication1
Public Partial Class Form2
Inherits Form
Public Sub New()
InitializeComponent()
End Sub

Private Sub Form2_Load(sender As Object, e As EventArgs)
Dim sList As New. SeriesList()
sList.ChartType = ChartType.Line
sList.AxisFactor.XAxis.DataType = AxisDataType.Number

sList.AxisFactor.YAxis.Direction = AxisDirection.Right

sList.AxisFactor.BackColor = Color.Transparent

sList.AxisFactor.YAxis.Line.LineColor = Color.White
sList.AxisFactor.XAxis.Line.LineColor = Color.White
sList.AxisFactor.YAxis.ForeColor = Color.White
sList.AxisFactor.XAxis.ForeColor = Color.White

sList.Legend.Visible = True
sList.Legend.BackColor = Color.FromArgb(50, Color.White)
sList.Legend.Header.NameLabel.Text = "Samung electronics Finance data (1997)dsdsd"

Dim tk As New. AxisTick(22100)
tk.Label.Text = "22,100" & vbCr & vbLf & "3.86%"
tk.BackColor = Color.Orange
tk.IsShowGridLine = True
tk.GridLine.LineColor = Color.Orange
tk.Label.ForeColor = Color.White
sList.AxisFactor.YAxis.ExtraTicks.Add(tk)

sList.Description.Label.Text = "SEOUL, April 29 - Samsung Electronics Co Ltd on Wednesday said it expects earnings to rise in the second quarter after posting its highest profit in three quarters in January-March, boosted by strong demand for its new Galaxy S6 flagship smartphones."
sList.Description.Label.ForeColor = Color.White
sList.Description.XDirection = AxisDirection.Right
sList.Description.YDirection = AxisDirection.Top

Dim r As New. Random()
For i As Integer = 0 To 0
Dim sr As New. Series()
sr.Points.Width = 0
sr.SeriesColor = Color.White
sr.ForeColor = Color.White
sr.Name = "Samung electronics Finance data (1997)"

sr.AreaType = AreaType.LineArea
sr.Line.LineAreaColors = New Color() {Color.FromArgb(13, 95, 119), Color.FromArgb(100, 13, 95, 119), Color.FromArgb(80, 13, 95, 119), Color.FromArgb(50, 13, 95, 119)}
sr.Line.AreaDesignType = AreaDesignType.Gradation
sr.Line.LineWidth = 4

For x As Integer = 0 To 99
Dim item As New. SeriesItem()
item.XValue = x
item.YValue = r.[Next](50, 300) * x

sr.items.Add(item)
Next

sList.SeriesCollection.Add(sr)
Next

Me.hHippoChart1.Designer.InnerBackColor = Color.Black
Me.hHippoChart1.SeriesListDictionary.Add(sList)
Me.hHippoChart1.DrawChart()


Draw2()
Draw3()
End Sub

Private Sub Draw2()
Dim sList As New. SeriesList()
sList.ChartType = ChartType.Pie
sList.Margin = 35

Dim r As New. Random()
For i As Integer = 0 To 0
Dim sr As New. Series()
sr.UnAxisFactor.TextLocation = UnAxisFigureTextLocation.Outer
sr.UnAxisFactor.UnAxisDisplayItemType = UnAxisDisplayItemType.Figure_Name
sr.UnAxisFactor.Pie3DDepth = 5
sr.UnAxisFactor.PieTypes = PieType.TwoDemention

For x As Integer = 0 To 4
Dim item As New. SeriesItem()
item.Name = "item" + x.ToString()
item.YValue = r.[Next](90)
item.IsShowFigureText = True

item.Label = New Hippo.Label()
item.Label.ForeColor = Color.White
item.Label.Font = New Font("굴림", 9, FontStyle.Bold)

sr.items.Add(item)
Next
sList.SeriesCollection.Add(sr)
Next
Me.hHippoChart2.Designer.InnerBackColor = Color.Black
Me.hHippoChart2.SeriesListDictionary.Add(sList)
Me.hHippoChart2.DrawChart()
End Sub

Private Sub Draw3()
Dim sList As New. SeriesList()
sList.ChartType = ChartType.Column

sList.AxisFactor.BackColor = Color.Transparent

sList.AxisFactor.YAxis.Line.LineColor = Color.White
sList.AxisFactor.XAxis.Line.LineColor = Color.White
sList.AxisFactor.YAxis.ForeColor = Color.White
sList.AxisFactor.XAxis.ForeColor = Color.White

sList.Legend.Visible = True
sList.Legend.Label.ForeColor = Color.White

Dim r As New. Random()
For i As Integer = 0 To 2
Dim sr As New. Series()
sr.Name = "Series" + i.ToString()
sr.ForeColor = Color.White

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

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

Me.hHippoChart3.Designer.InnerBackColor = Color.Black
Me.hHippoChart3.SeriesListDictionary.Add(sList)
Me.hHippoChart3.DrawChart()
End Sub

Private Sub hHippoChart1_ChartSizeChanged(sender As Object, e As EventArgs)
Me.hHippoChart1.DrawChart()
End Sub

Private Sub hHippoChart2_ChartSizeChanged(sender As Object, e As EventArgs)
Me.hHippoChart2.DrawChart()
End Sub

Private Sub hHippoChart3_ChartSizeChanged(sender As Object, e As EventArgs)
Me.hHippoChart3.DrawChart()
End Sub

Private Sub hScrollBar1_Scroll(sender As Object, e As ScrollEventArgs)

End Sub
End Class
End Namespace



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

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

helpdesk@hippochart.com





Copyright © 2009-2016, HippoChart. Inc.  All Rights Reserved.