Hello!
I made a line graph that is giving me the following output:
Below is the basic code:
chartProcessStats1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.LineChart 'chartProcessStats1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ScatterLineChart
Dim temparrayx() As Decimal = New Decimal() {-10, 10, 100, 110, 120} Dim temparrayy() As Decimal = New Decimal() {0.5, 3, 2, 3, 1}
Dim graphval As New NumericSeries()
Dim k As Integer = 0
chartProcessStats1.LineChart.ChartComponent.Series.Clear()
While (k < temperaturearray.Length)
graphval.Points.Add(New NumericDataPoint(temparrayy(k), temparrayx(k), False))
k = k + 1 End While
chartProcessStats1.LineChart.ChartComponent.Series.Add(graphval)
temperaturearray = {} errorarray = {}
It appears the output is a result of the x axis being entered as a string rather than a decimal (despite the fact the actual array is made up of decimal values). Is there a way to enter the x axis as decimals (so the graph scales properly)?
Thanks in advance!
Actually, if there's a way to change the range of the y axis as well (I want to change it to 0 to 3, for instance), that would be helpful to know as well. I've tried sorting through the pages on the site and I haven't been able to find the property I need to set. Thanks!
Hello Jeremy,
The LineChart will populate the series’ Y values with one row’s data found in each numeric column, and populate the X values according to the string keys of the columns themselves. It knows the x values only by the string keys, so this doesn’t provide the functionality of the chart understanding your x values that you want.
The Scatter Chart will populate the series using 2 numeric columns, and you will specify the X and Y columns via the UltraChart.ScatterChart.ColumnX and UltraChart.ScatterChart.ColumnY properties. For more information on this, please visit: http://help.infragistics.com/doc/WinForms?page=Chart_Working_with_Scatter_Chart_Data.html
This will allow the chart to understand your X values and, among other things, space out your points along the X axis according to their value. I’ve attached a sample project which should show you how you can create a ScatterChart with this ability.
Concerning changing the range of the axis, you’ll need to set the Axis’ RangeType to Custom to see your RangeMin and RangeMax settings appear.
Please let me know if there’s anything further I can help you with.
Consolidated Below
...Sorry again for all the posts but I was able to chip away at my issues. Just have a few outstanding. Below is what I'm aiming for (made in Excel):
Here is what I currently have:
Below is my sample code:
Dim temprow
UltraGrid1.DataSource = UltraDataSource1UltraDataSource1.Reset()
UltraDataSource1.Band.Columns.Add("Temp", GetType(Decimal))UltraDataSource1.Band.Columns.Add("Error 1", GetType(Decimal))UltraDataSource1.Band.Columns.Add("Error 2", GetType(Decimal))
While (k < temparrayx.Length)
temprow = New Object() {temparrayx(k), temparrayy(k), temparrayy2(k)}UltraDataSource1.Rows.Add(temprow)k = k + 1
End While
chartProcessStats1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.ScatterChart
chartProcessStats1.Axis.X.Labels.ItemFormatString = AxisItemLabelFormat.CustomchartProcessStats1.Axis.X.Labels.ItemFormatString = ""chartProcessStats1.Axis.X.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.HorizontalchartProcessStats1.Axis.X.RangeMin = -40chartProcessStats1.Axis.X.RangeMax = 140chartProcessStats1.Axis.X.Extent = 20chartProcessStats1.Axis.X.RangeType = AxisRangeType.Custom
chartProcessStats1.Axis.Y.Labels.ItemFormatString = AxisItemLabelFormat.CustomchartProcessStats1.Axis.Y.Labels.ItemFormatString = ""chartProcessStats1.Axis.Y.Labels.Orientation = Infragistics.UltraChart.Shared.Styles.TextOrientation.HorizontalchartProcessStats1.Axis.Y.RangeMin = 0chartProcessStats1.Axis.Y.RangeMax = 3.5chartProcessStats1.Axis.Y.Extent = 20chartProcessStats1.Axis.Y.RangeType = AxisRangeType.Custom
Dim ChartColors() As ColorChartColors = New Color() {Color.Blue, Color.Red, Color.Green, Color.Yellow, Color.Orange, Color.Indigo, Color.Violet}chartProcessStats1.ColorModel.CustomPalette = ChartColors
chartProcessStats1.ScatterChart.Icon = SymbolIcon.CirclechartProcessStats1.ScatterChart.IconSize = SymbolIconSize.SmallchartProcessStats1.ScatterChart.LineAppearance.DrawStyle = LineDrawStyle.SolidchartProcessStats1.ScatterChart.LineAppearance.SplineTension = 0chartProcessStats1.ScatterChart.LineAppearance.Thickness = 3
chartProcessStats1.ScatterChart.ConnectWithLines = True
chartProcessStats1.DataSource = UltraDataSource1
'chartProcessStats1.Data.IncludeColumn(0, True)'chartProcessStats1.Data.IncludeColumn(1, false)'chartProcessStats1.Data.IncludeColumn(2, True)chartProcessStats1.ScatterChart.ColumnX = 0chartProcessStats1.ScatterChart.ColumnY = 1
'chartProcessStats1.DataBind()
The last outstanding issues are:
1) I need to add an additional set of data onto the graph but I don't see how this is possible as I don't see how it's possible to do so using:
chartProcessStats1.ScatterChart.ColumnX = 0chartProcessStats1.ScatterChart.ColumnY = 1
If I have different X and Y axis', there doesn't appear to be a way to set them. I've tried commenting out the ColumnY line (since there are two other columns, I assume that, since it's linked to a datasource, there would be a way to setup multiple data sets but I can't seem to figure out how. (HIGH Priority)
2) When I hover over the points on the graph, I'd like it to display the x and y information (for example, -10,0.5 for one of the points rather than just -10), rather than just the x information (-10, in that example) (medium priority)
3) X Axis Label (low priority)
4) Y Axis Label (low priority)
5) Chart Label (low priority)
I imagine these are all very basic things that can be fixed with a few lines of code but, after combing through directories, examples in your forums, etc, it appears I'm unable to progress any further. Thank you again for all your help!
It's no problem, I'm glad we were able to ultimately provide you the functionality you need. Please let me know if there is anything else I can assist with.
Perfect! That worked!
Thanks for your help! Sorry it took so long . . . heh.
Jeremy,
I modified your sample, please let me know if you can now observe the axis line labels properly rendering.
They weren’t rendering because the Axis Label ItemFormatString was set to “”. I changed the format string to “<DATA_VALUE>”, and this gives us the desired labels.
I find that often, along with the help documentation and samples, a lot of information can be gleaned by looking into the UltraChart’s chart wizard. The wizard will often show you the properties it is setting according to your preferences, and if you still want to do this in code, you can then set the properties according to what you saw in the wizard.
I apologize that this has been a “one step forward one step back” process, but I hope the end result has been a strong understanding of all the UltraChart’s customizable features so that you will be able to use it to meet all your future needs.
Please don’t hesitate to contact us if the UltraChart still isn’t meeting your needs or you need any more assistance using it.
John, this got the issue with getting multiple series on there, which is a good step forward, but it's eliminated all the other work I had put into customizing the axis' and the markers.
This is what I'm currently seeing (from your example):
Beforehand, I was able to set this with the following controls (see the graph from 03-14-2016 11:57 PM):
When I add this back in, everything appears to be working now except the labels on the graph. Below is what I'm currently seeing:
As you can see, the scaling is correct but the labels have disappeared on the axis.
I'm including a project file for you to look at, since posting my code everytime doesn't seem to be getting us any closer. Can you please look at my exact code to help me determine the cause of the issue and resolve the issue I'm having rather than posting another example? Unfortunately, the examples your posting all seem to take a different approach and one step forward seems to be resulting in one step backwards as well. I think there's enough information in this thread for you to have a pretty good idea of what I'm aiming for (I don't think we're far off).
If you could help me resolve this issue, this will allow me to have:
1) The numeric axis
2) Multiple series
3) Making the x and y axis customizable (scaling, colors, etc)
4) Being able to customize the datapoints when hovering over them
5) Titles for the axis'
It looks like everything is working except for point 3 (since the axis labels don't appear to be visible or there's some other related issue).
Please let me know if you need any additional information. Thanks!
I modified my sample to demonstrate how to bind series to your UltraChart. Explanation for the Series Collection can be found at: http://help.infragistics.com/doc/WinForms?page=Chart_Series_Collection.html .
I believe this demonstration should achieve what you’re looking for and better guide you on how to do this with your data. Please let me know if you could use further guidance on binding multiple series to your chart.