using
System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Infragistics.UltraChart.Shared.Styles;
using Infragistics.UltraChart.Resources.Appearance;
using Infragistics.UltraChart.Core.Layers;
namespace Test
... {
/**//// <summary>
/// Col 的摘要说明。
/// </summary>
public class Col : System.Web.UI.Page
...{
protected Infragistics.WebUI.UltraWebChart.UltraChart UltraChart1;
private void Page_Load(object sender, System.EventArgs e)
...{
// 在此处放置用户代码以初始化页面
//step1:Change the ChartType property to "Composite."
this.UltraChart1.ChartType = ChartType.Composite;
//step2:Add a ChartArea to the ChartAreas collection.
ChartArea myChartArea = new ChartArea();
this.UltraChart1.CompositeChart.ChartAreas.Add(myChartArea);
//step3:Add some Axes to the ChartArea.
AxisItem axisX = new AxisItem();
axisX.OrientationType = AxisNumber.X_Axis;
axisX.DataType = AxisDataType.String;
axisX.SetLabelAxisType = SetLabelAxisType.GroupBySeries;
axisX.Labels.ItemFormatString = "<ITEM_LABEL>";
axisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;
AxisItem axisY = new AxisItem();
axisY.OrientationType = AxisNumber.Y_Axis;
axisY.DataType = AxisDataType.Numeric;
axisY.Labels.ItemFormatString = "<DATA_VALUE:0.#>";
myChartArea.Axes.Add(axisX);
myChartArea.Axes.Add(axisY);
//step4:Add some data series to the Series collection.
NumericSeries seriesA = GetNumericSeriesBound();
NumericSeries seriesB = GetNumericSeriesUnBound();
this.UltraChart1.CompositeChart.Series.Add(seriesA);
this.UltraChart1.CompositeChart.Series.Add(seriesB);
//step5:Add a chart layer.
ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();
myColumnLayer.ChartType = ChartType.ColumnChart;
myColumnLayer.ChartArea = myChartArea;
myColumnLayer.AxisX = axisX;
myColumnLayer.AxisY = axisY;
myColumnLayer.Series.Add(seriesA);
myColumnLayer.Series.Add(seriesB);
this.UltraChart1.CompositeChart.ChartLayers.Add(myColumnLayer);
//step6:Add a legend to the chart.
//CompositeLegend myLegend = new CompositeLegend();
//CompositeLegend a = new CompositeLegend();
Infragistics.UltraChart.Resources.Appearance.CompositeLegend myLegend = new Infragistics.UltraChart.Resources.Appearance.CompositeLegend();
//Infragistics.UltraChart.Resources.Appearance.CompositeLegendAppearance myLegend = new CompositeLegendAppearance();
myLegend.ChartLayers.Add(myColumnLayer);
myLegend.Bounds = new Rectangle(0, 75, 20, 25);
myLegend.BoundsMeasureType = MeasureType.Percentage;
myLegend.PE.ElementType = PaintElementType.Gradient;
myLegend.PE.FillGradientStyle = GradientStyle.ForwardDiagonal;
myLegend.PE.Fill = Color.CornflowerBlue;
myLegend.PE.FillStopColor = Color.Transparent;
myLegend.Border.CornerRadius = 10;
myLegend.Border.Thickness = 0;
this.UltraChart1.CompositeChart.Legends.Add(myLegend);
}
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
...{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
...{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
/**//// <summary>
/// 创建数据
/// </summary>
private DataTable GetData()
...{
DataTable table = new DataTable();
table.Columns.Add("Label Column", Type.GetType("System.String"));
table.Columns.Add("Value Column", Type.GetType("System.Double"));
table.Columns.Add("Another Value Column", Type.GetType("System.Double"));
table.Rows.Add(new object[] ...{"Point A", 1.0, 3.0});
table.Rows.Add(new object[] ...{"Point B", 2.0, 2.0});
table.Rows.Add(new object[] ...{"Point C", 3.0, 1.0});
table.Rows.Add(new object[] ...{"Point D", 4.0, 2.0});
table.Rows.Add(new object[] ...{"Point E", 5.0, 3.0});
return table;
}
/**//// <summary>
/// 绑定数据,数据库
/// </summary>
private NumericSeries GetNumericSeriesBound()
...{
NumericSeries series = new NumericSeries();
series.Label = "Series A";
DataTable table = GetData();
series.Data.DataSource = table;
series.Data.LabelColumn = "Label Column";
series.Data.ValueColumn = "Value Column";
return series;
}
/**//// <summary>
/// 绑定数据
/// </summary>
private NumericSeries GetNumericSeriesUnBound()
...{
NumericSeries series = new NumericSeries();
series.Label = "Series B";
series.Points.Add(new NumericDataPoint(5.0, "Point A", false));
series.Points.Add(new NumericDataPoint(4.0, "Point B", false));
series.Points.Add(new NumericDataPoint(3.0, "Point C", false));
series.Points.Add(new NumericDataPoint(2.0, "Point D", false));
series.Points.Add(new NumericDataPoint(1.0, "Point E", false));
return series;
}
}
}
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Infragistics.UltraChart.Shared.Styles;
using Infragistics.UltraChart.Resources.Appearance;
using Infragistics.UltraChart.Core.Layers;
namespace Test
... {
/**//// <summary>
/// Col 的摘要说明。
/// </summary>
public class Col : System.Web.UI.Page
...{
protected Infragistics.WebUI.UltraWebChart.UltraChart UltraChart1;
private void Page_Load(object sender, System.EventArgs e)
...{
// 在此处放置用户代码以初始化页面
//step1:Change the ChartType property to "Composite."
this.UltraChart1.ChartType = ChartType.Composite;
//step2:Add a ChartArea to the ChartAreas collection.
ChartArea myChartArea = new ChartArea();
this.UltraChart1.CompositeChart.ChartAreas.Add(myChartArea);
//step3:Add some Axes to the ChartArea.
AxisItem axisX = new AxisItem();
axisX.OrientationType = AxisNumber.X_Axis;
axisX.DataType = AxisDataType.String;
axisX.SetLabelAxisType = SetLabelAxisType.GroupBySeries;
axisX.Labels.ItemFormatString = "<ITEM_LABEL>";
axisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;
AxisItem axisY = new AxisItem();
axisY.OrientationType = AxisNumber.Y_Axis;
axisY.DataType = AxisDataType.Numeric;
axisY.Labels.ItemFormatString = "<DATA_VALUE:0.#>";
myChartArea.Axes.Add(axisX);
myChartArea.Axes.Add(axisY);
//step4:Add some data series to the Series collection.
NumericSeries seriesA = GetNumericSeriesBound();
NumericSeries seriesB = GetNumericSeriesUnBound();
this.UltraChart1.CompositeChart.Series.Add(seriesA);
this.UltraChart1.CompositeChart.Series.Add(seriesB);
//step5:Add a chart layer.
ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();
myColumnLayer.ChartType = ChartType.ColumnChart;
myColumnLayer.ChartArea = myChartArea;
myColumnLayer.AxisX = axisX;
myColumnLayer.AxisY = axisY;
myColumnLayer.Series.Add(seriesA);
myColumnLayer.Series.Add(seriesB);
this.UltraChart1.CompositeChart.ChartLayers.Add(myColumnLayer);
//step6:Add a legend to the chart.
//CompositeLegend myLegend = new CompositeLegend();
//CompositeLegend a = new CompositeLegend();
Infragistics.UltraChart.Resources.Appearance.CompositeLegend myLegend = new Infragistics.UltraChart.Resources.Appearance.CompositeLegend();
//Infragistics.UltraChart.Resources.Appearance.CompositeLegendAppearance myLegend = new CompositeLegendAppearance();
myLegend.ChartLayers.Add(myColumnLayer);
myLegend.Bounds = new Rectangle(0, 75, 20, 25);
myLegend.BoundsMeasureType = MeasureType.Percentage;
myLegend.PE.ElementType = PaintElementType.Gradient;
myLegend.PE.FillGradientStyle = GradientStyle.ForwardDiagonal;
myLegend.PE.Fill = Color.CornflowerBlue;
myLegend.PE.FillStopColor = Color.Transparent;
myLegend.Border.CornerRadius = 10;
myLegend.Border.Thickness = 0;
this.UltraChart1.CompositeChart.Legends.Add(myLegend);
}
Web 窗体设计器生成的代码#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
...{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/**//// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
...{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
/**//// <summary>
/// 创建数据
/// </summary>
private DataTable GetData()
...{
DataTable table = new DataTable();
table.Columns.Add("Label Column", Type.GetType("System.String"));
table.Columns.Add("Value Column", Type.GetType("System.Double"));
table.Columns.Add("Another Value Column", Type.GetType("System.Double"));
table.Rows.Add(new object[] ...{"Point A", 1.0, 3.0});
table.Rows.Add(new object[] ...{"Point B", 2.0, 2.0});
table.Rows.Add(new object[] ...{"Point C", 3.0, 1.0});
table.Rows.Add(new object[] ...{"Point D", 4.0, 2.0});
table.Rows.Add(new object[] ...{"Point E", 5.0, 3.0});
return table;
}
/**//// <summary>
/// 绑定数据,数据库
/// </summary>
private NumericSeries GetNumericSeriesBound()
...{
NumericSeries series = new NumericSeries();
series.Label = "Series A";
DataTable table = GetData();
series.Data.DataSource = table;
series.Data.LabelColumn = "Label Column";
series.Data.ValueColumn = "Value Column";
return series;
}
/**//// <summary>
/// 绑定数据
/// </summary>
private NumericSeries GetNumericSeriesUnBound()
...{
NumericSeries series = new NumericSeries();
series.Label = "Series B";
series.Points.Add(new NumericDataPoint(5.0, "Point A", false));
series.Points.Add(new NumericDataPoint(4.0, "Point B", false));
series.Points.Add(new NumericDataPoint(3.0, "Point C", false));
series.Points.Add(new NumericDataPoint(2.0, "Point D", false));
series.Points.Add(new NumericDataPoint(1.0, "Point E", false));
return series;
}
}
}