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.
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):
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
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.