I've got data that is formatted in a table as follows, and am displaying it in a Scatter Chart in WinChart version 7.3.20073.38:
Date (Text), Index (Integer), Value (Double) 2007-01-20, 1, 182708.213068332 2007-04-20, 2, 191849.206636247 2007-07-19, 3, 181909.247938635 2007-10-17, 4, 193106.239361725 2008-01-15, 5, 186136.687476901 2008-04-14, 6, 181598.738009246 2008-07-13, 7, 182911.470058264 2008-10-11, 8, 180885.534667417
The scatter chart is using the second column (Index) for the X Axis, and the third column (Value) for the Y Axis. The index column is used for the X axis so that I may use custom code to calculate and graph the best-fit polynomial on the chart. The first column is a text column, not a date column, representing the date that the value was taken.
I'm getting a chart as shown in the attached screen shot, but I would like the X axis labels to use the first text field in each row, instead of the second field. I've tried setting the X Axis label's ItemFormat to <ITEM_LABEL>, but this only results in the X Axis being labeled with a bunch of literal "<ITEM_LABEL>" strings.
How would I go about having the text fields show up as X Axis labels?
For a scatter chart both the x and y axis is numeric. There is no item or series equivalent at each of the tickmarks.
If you wanted to use a scatter, instead of line or the other chart types, then you could set a custom range on the axis and use a custom token using IRenderLabel. This allow you to post any string that you want. So, like 1 to 12. Then convert those to months. You can find IRenderLabel implementations all throughout the forum including my blog post.
Hi Sung Kim,
I modified the graph to scatter plot and the button2 code to this:
private
void button2_Click(object sender, EventArgs e) {
//ultraChart1.Axis.X.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.ItemLabel;
ultraChart1.Axis.X.Labels.ItemFormat =
AxisItemLabelFormat.Custom;
ultraChart1.Axis.X.Labels.ItemFormatString =
"<SERIES_LABEL>";}
The "symptoms" are the same just like my software. When i click the button2, it will change the X axis to only SERIES_LABEL for all ticks. BUT, when I highlight one of the plot, and move my mouse to outside of the graph boundary box, it will immediately populate ALL the ticks to the corresponding month for instance JUNE. I attach the image. Thanks. Bobby Pohan
I tried the attachment that you included on ur previous post. It worked untl I changed the graph to scatter plot. So, I assume this only works on bar graph then? Is there a way to work around so that I can use the same functionality in the scatter plot? Thanks. Bobby Pohan
I am not sure what is happening over here. I even tested your code on the Infragistics sample code. I used LabelsTitlesTooltips: CustomToolTips form. I changed the graph to scatter plot. I still received the same behavior. It "<ITEM_LABELS> on the X axis. Let me remind you that I use VB.Net instead of C# if that makes any difference. Do I need to set up something when changing the graph to scatter plot? Thanks. Bobby Pohan
I am using the following and not seeing an issue (9.1 vs08 sample attached):
private void Form1_Load(object sender, EventArgs e){ DataTable dt = new DataTable(); dt.Columns.Add("Month", typeof(string)); dt.Columns.Add("Leads", typeof(int)); dt.Columns.Add("Sales", typeof(int)); dt.Rows.Add("January", 120, 50); dt.Rows.Add("February", 90, 44); dt.Rows.Add("March", 70, 22); dt.Rows.Add("April", 66, 21); dt.Rows.Add("May", 80, 42); dt.Rows.Add("June", 85, 48); ultraChart1.Data.DataSource = dt; ultraChart1.Data.DataBind();}
private void button1_Click(object sender, EventArgs e){ ultraChart1.Axis.X.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue;}
private void button2_Click(object sender, EventArgs e){ ultraChart1.Axis.X.Labels.ItemFormat = Infragistics.UltraChart.Shared.Styles.AxisItemLabelFormat.ItemLabel;}