In following the steps given on the web site below, I am able to generate a chart, but only with the axis value I entered in the wizard, but I am wanting to use the values from a data source. I must be missing something very simple. I have added a data source, but values not there. Help please?
http://help.infragistics.com/Help/NetAdvantage/NET/2007.3/CLR2.0/html/Chart_Creating_a_Composite_Chart_Using_the_Chart_Wizard_Part_1_of_2.html
http://help.infragistics.com/Help/NetAdvantage/NET/2007.3/CLR2.0/html/Chart_Creating_a_Composite_Chart_Using_the_Chart_Wizard_Part_2_of_2.html
I wanted to send some screen shots of what is going on. I want the data to come from a view in SQL 2005.
Still does not work...here is my code.
Inherits System.Web.UI.Page
End Sub
Dim series As New Infragistics.UltraChart.Resources.Appearance.NumericSeries()
series.Label = "Series A"
' this code populates the series from an external data source
'Dim table As Data.DataTable = Me.GetData()
series.Data.DataSource = SqlDataSource1
series.Data.LabelColumn = "Label Column"
series.Data.ValueColumn = "Value Column"
End Function
End Class
Currently, the chart series object can only be bound to a data table, so you will need to extract the table from the data source. Assuming you have columns 'column1' as string and 'column2' as float or anything numeric in your datasource, this should work.
Dim series As New NumericSeriesUltraChart1.CompositeChart.Series.Add(series)Dim dv As New DataViewdv = Me.SqlDataSource1.Select(Web.UI.DataSourceSelectArguments.Empty)series.Data.DataSource = dv.Tableseries.Data.LabelColumn = "column1"series.Data.ValueColumn = "column2"UltraChart1.CompositeChart.ChartLayers(0).Series.Add(series)
I am having a problem to databind to my Composite Graph - i have the following:
DAL with DataTable with Column called Fiscal_Month, 2007, 2008, 2009
TableAdapter FillBy CustomerID and ProductID
Not sure how to bind them to the series
Are you trying to display a column chart? which of your columns are numeric? Assuming it's a column chart and fiscal_month is a string column and 2007,2008,2009 are numeric columns, you need to create 3 different NumericSeries objects and databind each series to the respective numeric column.
series1.Data.DataSource = myTable;series1.Data.LabelColumn = "Fiscal_Month";series1.Data.ValueColumn = "2007";
series2.Data.DataSource = myTable;series2.Data.LabelColumn = "Fiscal_Month";series2.Data.ValueColumn = "2008";
etc...
G'day Max
Currently i have a graph - see image - that is created from a query in a DAL and then 2 paramertors are passed - customer, and the other from a control on the page - this displays fine - however, i am now tyring it create it with a line graph on top - therefore using the composite graph - i am just haveing trouble getting the Numeric Series to see the datasource.
this.FiscalInputCostChart.ChartType = ChartType .Composite;
ChartArea myChartArea = new ChartArea();
this.FiscalInputCostChart.CompositeChart.ChartAreas.Add(myChartArea);
AxisItem axisX = new AxisItem();
axisX.OrientationType =
AxisNumber .X_Axis;
axisX.DataType =
AxisDataType.String;
axisX.SetLabelAxisType =
SetLabelAxisType .GroupBySeries;
axisX.Labels.ItemFormatString = "
Fiscal\nMonth\n<SERIES_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);
ChartLayerAppearance myColumnLayer = new ChartLayerAppearance();
myColumnLayer.ChartType =
ChartType.ColumnChart;
myColumnLayer.ChartArea = myChartArea;
myColumnLayer.AxisX = axisX;
myColumnLayer.AxisY = axisY;
//myColumnLayer.Series.Add(series);
NumericSeries seriesColumn1 = new NumericSeries();
seriesColumn1.Data.DataSource = odsInput;
seriesColumn1.Data.LabelColumn =
"Fiscal_Month";
seriesColumn1.Data.ValueColumn =
"2007";
NumericSeries seriesColumn2 = new NumericSeries();
seriesColumn2.Data.DataSource = odsInput;
seriesColumn2.Data.LabelColumn =
seriesColumn2.Data.ValueColumn =
"2008";
NumericSeries seriesColumn3 = new NumericSeries();
seriesColumn3.Data.DataSource = odsInput;
seriesColumn3.Data.LabelColumn =
seriesColumn3.Data.ValueColumn =
"2009";
Trying to get the data source this way
{
dt.Columns.Add(
"Fiscal_Month", typeof(string));
"2007", typeof(int));
"2008", typeof(int));
"2009", typeof(int));
I would really appreciate your direction on this.
Thanks Max, you blokes have been such a great help gettiing my head around charting.
Thanks so much!
For Item Labels:seriesColumn1.Label = "2007";seriesColumn2.Label = "2008";seriesColumn3.Label = "2009";xAxisColumn.Labels.Orientation = TextOrientation.VerticalLeftFacing;
For Series Labels:xAxisColumn.Labels.SeriesLabels.Layout.Behavior = AxisLabelLayoutBehaviors.UseCollection;AxisLabelLayoutBehavior behavior = new WrapTextAxisLabelLayoutBehavior();behavior.Enabled = true;behavior.EnableRollback=false;behavior.UseOnlyToPreventCollisions=false;xAxisColumn.Labels.SeriesLabels.Layout.BehaviorCollection.Add(behavior);
Ok, one more issue - i am trying to get the SeriesLables to center and show the colomn names ie. 2007, 2008 and 2009 i tried everything i know to do but alas -
xAxisColumn.DataType = AxisDataType.String; xAxisColumn.OrientationType = AxisNumber.X_Axis;xAxisColumn.SetLabelAxisType = SetLabelAxisType.GroupBySeries;xAxisColumn.Labels.HorizontalAlign = StringAlignment.Center;xAxisColumn.Labels.VerticalAlign = StringAlignment.Center;xAxisColumn.Labels.SeriesLabels.FormatString = "Fiscal\nMonth\n";xAxisColumn.Labels.Orientation = TextOrientation.VerticalLeftFacing;xAxisColumn.RangeType = AxisRangeType.Automatic;xAxisColumn.LineThickness = 1;
xAxisLine.DataType = AxisDataType.String;xAxisLine.SetLabelAxisType = SetLabelAxisType.ContinuousData;xAxisLine.Labels.Orientation = TextOrientation.VerticalLeftFacing;xAxisLine.LineThickness = 1;xAxisLine.Margin.Near.MarginType = LocationType.Percentage;xAxisLine.Margin.Near.Value = 3;xAxisLine.Margin.Far.MarginType = LocationType.Percentage;xAxisLine.Margin.Far.Value = 3;
That worked great!! Thanks so much !
1. The best way is to setyAxis.TickmarkStyle = AxisTickStyle.Smart;This setting automatically picks a round interval, along with start and end values. 2. This is something that requires a little bit of trial and error. You can set a margin on the x axis that you use for the line layer in order to make the line points appear in the center of the column points. A value of 3 or 4 percent seems to work well.
xAxisLine.Margin.Near.MarginType =
LocationType.Percentage;xAxisLine.Margin.Near.Value = 3;xAxisLine.Margin.Far.MarginType = LocationType.Percentage;xAxisLine.Margin.Far.Value = 3;