使用ZedGraph制作联动图表
2014-04-22 09:07
281 查看
先上图
代码中都是通过设置图标属性来完成图标的创建的,思路很清晰,进而也说明图标内部功能很强大。
public class SynchronizedPanes : DemoBase
{
public SynchronizedPanes()
: base( "A demo that shows how multiple GraphPanes can be synchronized to scroll together." +
" Test it by zooming in on one pane (all panes will zoom together). Then, scroll to" +
" see all panes move together.",
"Synchronized Panes Demo", DemoType.Line )
{
//MasterPane包括了一系列GraphPane,以一种形式组织它们
MasterPane master = base.MasterPane;
master.Fill = new Fill( Color.White, Color.FromArgb( 220, 220, 255 ), 45.0f );
master.PaneList.Clear();
master.Title.IsVisible = true;
master.Title.Text = "Synchronized Graph Demo";
master.Margin.All = 10;
master.InnerPaneGap = 0;
ColorSymbolRotator rotator = new ColorSymbolRotator();
for ( int j = 0; j < 3; j++ )
{
// Create a new graph with topLeft at (40,40) and size 600x400
GraphPane myPaneT = new GraphPane( new Rectangle( 40, 40, 600, 400 ),
"Case #" + ( j + 1 ).ToString(),
"Time, Days",
"Rate, m/s" );
myPaneT.Fill.IsVisible = false;
myPaneT.Chart.Fill = new Fill( Color.White, Color.LightYellow, 45.0F );
myPaneT.BaseDimension = 3.0F;
myPaneT.XAxis.Title.IsVisible = false;
myPaneT.XAxis.Scale.IsVisible = false;
myPaneT.Legend.IsVisible = false;
myPaneT.Border.IsVisible = false;
myPaneT.Title.IsVisible = false;
myPaneT.XAxis.MajorTic.IsOutside = false;
myPaneT.XAxis.MinorTic.IsOutside = false;
myPaneT.XAxis.MajorGrid.IsVisible = true;
myPaneT.XAxis.MinorGrid.IsVisible = true;
myPaneT.Margin.All = 0;
if ( j == 0 )
myPaneT.Margin.Top = 20;
if ( j == 2 )
{
myPaneT.XAxis.Title.IsVisible = true;
myPaneT.XAxis.Scale.IsVisible = true;
myPaneT.Margin.Bottom = 10;
}
if ( j > 0 )
myPaneT.YAxis.Scale.IsSkipLastLabel = true;
// This sets the minimum amount of space for the left and right side, respectively
// The reason for this is so that the ChartRect's all end up being the same size.
myPaneT.YAxis.MinSpace = 60;
myPaneT.Y2Axis.MinSpace = 20;
// Make up some data arrays based on the Sine function
double x, y;
PointPairList list = new PointPairList();
for ( int i = 0; i < 36; i++ )
{
x = (double)i + 5 + j * 3;
y = 3.0 * ( 1.5 + Math.Sin( (double)i * 0.2 + (double)j ) );
list.Add( x, y );
}
LineItem myCurve = myPaneT.AddCurve( "Type " + j.ToString(),
list, rotator.NextColor, rotator.NextSymbol );
myCurve.Symbol.Fill = new Fill( Color.White );
master.Add( myPaneT );
}
using ( Graphics g = base.ZedGraphControl.CreateGraphics() )
{
ZedGraphControl z1 = base.ZedGraphControl;
master.SetLayout( g, PaneLayout.SingleColumn );
z1.AxisChange();
z1.IsAutoScrollRange = true;
z1.IsShowHScrollBar = true;
z1.IsShowVScrollBar = true;
z1.IsSynchronizeXAxes = true;
}
base.ZedGraphControl.AxisChange();
}
}
代码中都是通过设置图标属性来完成图标的创建的,思路很清晰,进而也说明图标内部功能很强大。
public class SynchronizedPanes : DemoBase
{
public SynchronizedPanes()
: base( "A demo that shows how multiple GraphPanes can be synchronized to scroll together." +
" Test it by zooming in on one pane (all panes will zoom together). Then, scroll to" +
" see all panes move together.",
"Synchronized Panes Demo", DemoType.Line )
{
//MasterPane包括了一系列GraphPane,以一种形式组织它们
MasterPane master = base.MasterPane;
master.Fill = new Fill( Color.White, Color.FromArgb( 220, 220, 255 ), 45.0f );
master.PaneList.Clear();
master.Title.IsVisible = true;
master.Title.Text = "Synchronized Graph Demo";
master.Margin.All = 10;
master.InnerPaneGap = 0;
ColorSymbolRotator rotator = new ColorSymbolRotator();
for ( int j = 0; j < 3; j++ )
{
// Create a new graph with topLeft at (40,40) and size 600x400
GraphPane myPaneT = new GraphPane( new Rectangle( 40, 40, 600, 400 ),
"Case #" + ( j + 1 ).ToString(),
"Time, Days",
"Rate, m/s" );
myPaneT.Fill.IsVisible = false;
myPaneT.Chart.Fill = new Fill( Color.White, Color.LightYellow, 45.0F );
myPaneT.BaseDimension = 3.0F;
myPaneT.XAxis.Title.IsVisible = false;
myPaneT.XAxis.Scale.IsVisible = false;
myPaneT.Legend.IsVisible = false;
myPaneT.Border.IsVisible = false;
myPaneT.Title.IsVisible = false;
myPaneT.XAxis.MajorTic.IsOutside = false;
myPaneT.XAxis.MinorTic.IsOutside = false;
myPaneT.XAxis.MajorGrid.IsVisible = true;
myPaneT.XAxis.MinorGrid.IsVisible = true;
myPaneT.Margin.All = 0;
if ( j == 0 )
myPaneT.Margin.Top = 20;
if ( j == 2 )
{
myPaneT.XAxis.Title.IsVisible = true;
myPaneT.XAxis.Scale.IsVisible = true;
myPaneT.Margin.Bottom = 10;
}
if ( j > 0 )
myPaneT.YAxis.Scale.IsSkipLastLabel = true;
// This sets the minimum amount of space for the left and right side, respectively
// The reason for this is so that the ChartRect's all end up being the same size.
myPaneT.YAxis.MinSpace = 60;
myPaneT.Y2Axis.MinSpace = 20;
// Make up some data arrays based on the Sine function
double x, y;
PointPairList list = new PointPairList();
for ( int i = 0; i < 36; i++ )
{
x = (double)i + 5 + j * 3;
y = 3.0 * ( 1.5 + Math.Sin( (double)i * 0.2 + (double)j ) );
list.Add( x, y );
}
LineItem myCurve = myPaneT.AddCurve( "Type " + j.ToString(),
list, rotator.NextColor, rotator.NextSymbol );
myCurve.Symbol.Fill = new Fill( Color.White );
master.Add( myPaneT );
}
using ( Graphics g = base.ZedGraphControl.CreateGraphics() )
{
ZedGraphControl z1 = base.ZedGraphControl;
master.SetLayout( g, PaneLayout.SingleColumn );
z1.AxisChange();
z1.IsAutoScrollRange = true;
z1.IsShowHScrollBar = true;
z1.IsShowVScrollBar = true;
z1.IsSynchronizeXAxes = true;
}
base.ZedGraphControl.AxisChange();
}
}
相关文章推荐
- 使用Open Flash Chart(OFC)制作图表(Struts2处理)
- 如何使用Axure:[8]制作联动下拉菜单
- 如何用QuickBI制作图表联动的销售报表
- Highcharts使用教程(1):制作简单图表
- 使用 制作出漂亮的图表
- 使用owc11制作图表又一实例
- 使用D3制作统计图表、线性图表、水平柱状图表、饼图 -- (一)线性图表
- c#(winform)使用mschart控件制作图表-----问题及解决
- 使用HelloCharts开源图表库制作柱状图
- 如何使用Dojo的DatePicker控件制作联动日期选择器
- 使用ZedGraph制作动态更新的统计图
- 使用D3制作图表(一)
- 使用Highcharts制作简单图表
- 使用ZedGraph制作动态更新的统计图
- 使用ZedGraph制作动态更新的统计图 --转
- 使用Open Flash Chart(OFC)制作图表(Struts2处理)
- 使用ZedGraph制作动态更新的统计图
- Android制作曲线、柱状图、饼形等图表——使用AChartEngine
- C#图表控件ZedGraph使用
- Android制作曲线、柱状图、饼形等图表——使用AChartEngine