I have a 2 column datatable..
First Column is the Item
Second Column is the QuantitySold
This is to display a top 50 products sold...
I want it to look
Product 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Product 2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Product 3 xxxxxxxxxxxxxxxxxxxxxxxxxxx
Product 4 xxxxxxxxxxxxxxxxxxxxxxxx
etc....
the xxxxx representing the column bar which would be longer if I sold more items.
What chart type should I use...
And How do i use the first column as the labels ?
thanks
Hi,
You need the Bar chart type:
http://help.infragistics.com/NetAdvantage/WinForms/2010.1/CLR2.0/?page=Chart_Working_with_2D_Bar_Chart_Data.html
Here is a sample code, demonstrating your desired behavior:
public partial class Form1 : Form{ UltraChart ultraChart1; public Form1() { InitializeComponent(); ultraChart1 = new UltraChart(); ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.BarChart; ultraChart1.Axis.Y.Labels.ItemFormat = AxisItemLabelFormat.None; ultraChart1.DataSource = GetTable(); ultraChart1.DataBind(); this.Controls.Add(ultraChart1); } private DataTable GetTable() { DataTable mydata = new DataTable(); //Define the columns and their names mydata.Columns.Add("Item", typeof(string)); mydata.Columns.Add("QuantitySold", typeof(int)); //Add the rows of data mydata.Rows.Add(new Object[] { "Product 1", 125 }); mydata.Rows.Add(new Object[] { "Product 2", 15 }); mydata.Rows.Add(new Object[] { "Product 3", 1 }); mydata.Rows.Add(new Object[] { "Product 4", 25 }); return mydata; } }
It works well.. thanks.
I have another question.. Using a PieChart.. i managed to choose which column of my dataset (the first for labels and last for the data). I don't see the label on my piechart.
Is these a trick ? my code is this
For i As Integer = 0 To dt4.Columns.Count - 2 Me.UltraChart4.Data.IncludeColumn(i, False) Next
Hi Fred,
Excuse me for the late reply.
Does the problem still persist?