I am retrieving data in the following format
Column1 Column2
0.1 0.2
0.3 0.2
ultraChart1.DataSource = dataSet;
ultraChart1.DataBind();
I get the error: You must include at least one row and two numeric columns in Scatter Chart Appearance - ColumnX and ColumnY
Any suggestions?
You need to add and one text column. You can try something like:
this.ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ScatterChart;
DataTable table = new DataTable();
table.Columns.Add("Label", typeof(string));
table.Columns.Add("Column1", typeof(double));
table.Columns.Add("Column2", typeof(double));
table.Rows.Add(new object[ { "a", 0.1, 0.2 });
table.Rows.Add(new object[ { "b", 0.3, 0.2 });
this.ultraChart1.DataSource = table;
this.ultraChart1.DataBind();
For your case you can try using:
XYSeries series1 = new XYSeries();
series1.Points.Add(new XYDataPoint(2, 0.2, "", false));
series2.Points.Add(new XYDataPoint(3, 0.2, "", false));
this.ultraChart1.Series.Add(series1);
this.ultraChart1.Series.Add(series2);
About your second question I'm not sure that I understand it.
Hi,
I have defined my UltraChart as BubbleChart during design time and at run time I add the series and datapoints. I am getting the error "you must include one row and three numeric columns. Any ideas?
Try using XYZDataPoint instead of XYDataPoint.
I have read this code over and over. I am not following something. I am guessing that this would be inside the loop, so after adding points to my series I should set my labels?
Almost there:
ultraJSM.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.BubbleChart;ultraJSM.Axis.X.RangeMax = 13;
ultraJSM.Axis.Y.ScrollScale.Visible = true;ultraJSM.Axis.Y.ScrollScale.Scale = 1;ultraJSM.Axis.X.ScrollScale.Visible = true;ultraJSM.Axis.X.ScrollScale.Scale = 1;
ultraJSM.Axis.X.RangeType = Infragistics.UltraChart.Shared.Styles.AxisRangeType.Custom;
ultraJSM.Axis.X.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.Horizontal; ultraJSM.Axis.X.Labels.ItemFormatString = "<MY_VALUE>";ultraJSM.Axis.Y.Labels.ItemFormatString = "<MY_VALUE>"; Hashtable labelHashTable = new Hashtable();
if (!labelHashTable.ContainsKey("MY_VALUE")){ labelHashTable.Add("MY_VALUE", new MyLabelRenderer(_ArrayStatuses, _ArrayJobs));}else{ labelHashTable.Remove("MY_VALUE"); labelHashTable.Add("MY_VALUE", new MyLabelRenderer(_ArrayStatuses, _ArrayJobs));}
if (ultraJSM.LabelHash != null) { ultraJSM.LabelHash = null; }ultraJSM.LabelHash = labelHashTable;
//I set my points PaintYAxis........
public class MyLabelRenderer : iChart.IRenderLabel{ArrayList _Statuses; //always would be 13 elements for the X-AxisArrayList _Jobs; //many elements for the Y-Axis
public MyLabelRenderer(ArrayList pArray, ArrayList pJobs){ _Statuses = pArray; _Jobs = pJobs;}
public string ToString(Hashtable context){ double z = (double)context["DATA_VALUE"]; string xLabel;
if (z == 0.0 ) { xLabel = ""; } else { if ((Convert.ToInt32(z)) <= _Statuses.Count) { xLabel = _Statuses[(Convert.ToInt32(z) - 1)].ToString(); } else { xLabel = _Jobs[(Convert.ToInt32(z) - (_Statuses.Count)].ToString(); } }
return xLabel;}}
What I do is check if the DATA_VALUE is less than the size of my arraylist, _Statuses, then I know this label is for the X-Axis, elseit would be for the Y-Axis. I would expect DATA_VALUE to be in increments of 1, but for the X-Axis it is in multiple of two such as 0.0, 2.0, 4.0, etc.The Y-Axis is in multiple of five such as 10.0, 15.0, 20.0, etc. How can change this setting for X-Axis to start from 0.0 to 13.0, and Y-Axis from 20to 100 in the increment of 1? Oh yeah, the values inside of the bubble? You have been great. Thanks,
Try unchecking "Show data values on chart" and put the following code:
chartTextAppearance.ItemFormatString = "<MY_VALUE>";
chartTextAppearance.Row = -2;
chartTextAppearance.Column = -2;
this.ultraChart1.BubbleChart.ChartText.Add(chartTextAppearance);
Hashtable labelHashTable = new Hashtable();
this.ultraChart1.LabelHash = labelHashTable;
....
public class MyLabelRenderer : IRenderLabel
{
public string ToString(Hashtable context) { double x = (double)context["DATA_VALUE_X"]; double y = (double)context["DATA_VALUE_Y"];double z = (double)context["DATA_VALUE"]; // put the code for getting the custom labels that you want to show herereturn x.ToString() + ", " + y.ToString() + ", " + z.ToString(); }
double x = (double)context["DATA_VALUE_X"]; double y = (double)context["DATA_VALUE_Y"];double z = (double)context["DATA_VALUE"]; // put the code for getting the custom labels that you want to show herereturn x.ToString() + ", " + y.ToString() + ", " + z.ToString();
double y = (double)context["DATA_VALUE_Y"];
// put the code for getting the custom labels that you want to show here
}
For more info about IRenderLabel Interface - http://help.infragistics.com/Help/NetAdvantage/NET/2008.1/CLR2.0/html/Chart_Customize_Labels_Using_the_IRenderLabel_Interface.html
I have that set but it shows the value I assign to ValueZ of the XYZDataPoint. This is taking the integer value, whereas I want to be able to display string inside these points at runtime.
void Paint() { DataTable dtTemp; Int16 hValue = 0;
ultraJSM.Series.Clear();
dtTemp = _dtIncurred;
System.Collections.IEnumerator cJobs = uceJobCards.Items.GetEnumerator(); while (cJobs.MoveNext()) { String dRow = (cJobs.Current as Infragistics.Win.ValueListItem).DataValue.ToString(); DataRow [dPoints = dtTemp.Select("JobCardNo = '" + dRow.ToString() + "'"); hValue++;
for (int i = 0; i < dPoints.Length; i++) { _dClass.SetJobCardID(dPoints["JobCardNo"].ToString());
iChart.Appearance.XYZSeries dSeries = new iChart.Appearance.XYZSeries(); dSeries.Label = dPoints["Status"].ToString();
iChart.Appearance.XYZDataPoint dPoint = new iChart.Appearance.XYZDataPoint();
dPoint.Label = dPoints["ActivityDateTime"].ToString(); //this doesn't do anything
dPoint.ValueY = hValue; dPoint.ValueX = _ArrayStatuses.IndexOf(dPoints["Status"].ToString()) + 1;
dPoint.ValueZ = 0.2; //this values is placed inside the bubble
dSeries.Points.Add(dPoint); ultraJSM.Series.Add(dSeries); } } }
And I cannot get my labels on the X or the Y axis. I need serious help. I have been reading the Infra Help, but I guess I am missing something. Would you be kind enough to explain. What I want to achieve is:
- The database has values that I want to paint on the X Axis, so instead of 1 to 10, I want to show my labels "Invoice", "Billing", etc
- The Y Axis values should be passed from the datatable, such as 'Invoice No. INV/08/012'
- For each 'Invoice No' on Y Axis, we track if a certain process (on X Axis) has been completed.
Please advice if the approach used above is correct for my scenario. Thank you.
You can put labels inside of the bubble with the help of the Chart Wizard. Go to Chart Wizard - Data Labels - and check "Show data values on chart".
Thanks. That worked. However the points are round and hollow, and not bubble with colors. I have specified the ChartType for UltraChart as BubbleChart. How can I place a label inside of the bubble? I want to provide a string value. You have been great!
Thanks,