My first Bar Chart in Ultrachart and I'm having problem.
This is the result I get from this table:
year Total Assets Total Revenue Total Liabilities Total Expenditures2010 85411648.00 57848779.00 11933949.00 60057828.002011 88245533.00 60372377.00 13348894.00 60482052.002012 85411648.00 57848779.00 11933949.00 60057828.002013 88245533.00 60372377.00 13348894.00 60482052.00
How can I change the Legend to reflect the column "YEAR" and remove the text "ROW#" underneath every columns?
My code:
UltraChart ucFinancialChart1 = new UltraChart();ucFinancialChart1.Data.DataSource = financialData;ucFinancialChart1.Axis.Y.RangeType = Infragistics.UltraChart.Shared.Styles.AxisRangeType.Custom;ucFinancialChart1.Axis.Y.RangeMax = 100000000;ucFinancialChart1.Axis.Y.RangeMin = 0;ucFinancialChart1.ColorModel.ColorBegin = System.Drawing.Color.Pink;ucFinancialChart1.ColorModel.ColorBegin = System.Drawing.Color.DarkRed;ucFinancialChart1.ColorModel.ModelStyle = Infragistics.UltraChart.Shared.Styles.ColorModels.CustomLinear;ucFinancialChart1.Border.Thickness = 0;ucFinancialChart1.Legend.Visible = true;ucFinancialChart1.Legend.Location = Infragistics.UltraChart.Shared.Styles.LegendLocation.Bottom;ucFinancialChart1.Legend.SpanPercentage = 35;ucFinancialChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ColumnChart;ucFinancialChart1.Width = new Unit(600, UnitType.Pixel);ucFinancialChart1.Height = new Unit(600, UnitType.Pixel);ucFinancialChart1.Data.IncludeColumn(0, false); ucFinancialChart1.Data.SwapRowsAndColumns = true;ucFinancialChart1.Data.DataBind();
Hello Roger,
There are different approaches to solve this task, depending of your scenario. Here are few possible options:
Option 1: You could choose one of the options in DataAssociation. For example:
ultraChart1.Legend.DataAssociation = Infragistics.UltraChart.Shared.Styles.ChartTypeData.ColumnData;
Option 2: You could use combination of these settings:
ultraChart1.Data.UseRowLabelsColumn =true;
ultraChart1.Data.RowLabelsColumn = 0;
Option 3: If you have composite chart (composite legend) then you could specify these settings through the layers . For example:
CompositeLegend m_ChartLegend = new CompositeLegend();
ColumnLayer.LegendItem = LegendItemType.Series;
LineLayer.LegendItem = LegendItemType.Series;
m_ChartLegend.ChartLayers.Add(ColumnLayer);
m_ChartLegend.ChartLayers.Add(LineLayer);
m_ChartLegend.BoundsMeasureType = MeasureType.Percentage;
m_ChartLegend.Bounds = new Rectangle(1, 10, 18, 20);
area.BoundsMeasureType = MeasureType.Percentage;
area.Bounds = new Rectangle(25, 10, 74, 90);
m_ChartLegend.PE.ElementType = PaintElementType.Gradient;
m_ChartLegend.PE.FillGradientStyle = GradientStyle.Circular;
m_ChartLegend.PE.Fill = Color.Yellow;
m_ChartLegend.PE.FillStopColor = Color.Orange;
m_ChartLegend.Border.CornerRadius = 10;
m_ChartLegend.Border.Thickness = 0;
m_ChartLegend.LabelStyle.FontSizeBestFit = true;
ultraChart1.CompositeChart.Legends.Add(m_ChartLegend);
Let me know if you have any questions.
Thanks for the reply.
The problem came from bad data.
The "YEAR" field was set as an INT and should have been a varchar.
Problem solved.
Thanks,
Resolved.
Thanks for your response. I'm glad to hear that your issue is solved.
If you have any questions, feel free to write us