Hi,
I use the UltraWinChart.UltraChart for a graphic and there are some data that dont appear in the graphic
See my excel file in attachement for the graphic and I also paste the VB code that I use into the second sheet of my excel file.
It would be easier to understand my problem.
You also have the data coming out from the dataTable that is binding into the Graphic
How can I correct this problem
Is that a bug or it is the way the graphic should react
If it is not possible to show the value for the Week 17 with this type of graphic which one should I use
Thanks in advance and have a nice day
I quickly tried David's code above and it did not put the points where I expected.. I did not get a chance to talk it over with him though. Did it work for you, Yann?
In my own sample (still a work in progress), I am also not getting the points in the right places; the mapping of the coordinates is still off. I am correctly able to identify the "detached" points that need to be drawn. I will be passing this onto someone else since I will be away for the next couple of weeks.
Hopefully David's solution is working and I did something wrong in my test (a distinct possibility), or we will get a new sample or snippet out to you soon.
ok, when i actually tried this, the closest i got was symbols displaying over all points, including null ones. so i'm not sure that approach would have worked.
here's a FillSceneGraph event handler that should add symbols over isolated "single point lines" in your composite chart:
Private Sub chtMainGraph_FillSceneGraph(ByVal sender As System.Object, ByVal e As Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs) Handles chtMainGraph.FillSceneGraph For Each layerApp As ChartLayerAppearance In Me.chtMainGraph.CompositeChart.ChartLayers If layerApp.ChartType = ChartType.LineChart OrElse layerApp.ChartType = ChartType.SplineChart Then Dim xAxis As IAdvanceAxis = CType(layerApp.ChartLayer.Grid("X"), IAdvanceAxis) Dim yAxis As IAdvanceAxis = CType(layerApp.ChartLayer.Grid("Y"), IAdvanceAxis) For Each currentSeries As NumericSeries In layerApp.Series If currentSeries.Points.Count = 0 Then Resume Next Dim soloPointFirst As Boolean = currentSeries.Points.Count = 1 OrElse (Not currentSeries.Points(0).Empty AndAlso currentSeries.Points(1).Empty) If soloPointFirst Then Dim location As New Point(xAxis.Map(0), yAxis.Map(currentSeries.Points(0).Value)) Me.AddSymbol(e.SceneGraph, location) End If For current As Integer = 1 To currentSeries.Points.Count - 2 Dim soloPoint As Boolean = Not currentSeries.Points(current).Empty AndAlso currentSeries.Points(current - 1).Empty AndAlso currentSeries.Points(current + 1).Empty If soloPoint Then Dim location As New Point(xAxis.Map(current), yAxis.Map(currentSeries.Points(current).Value)) Me.AddSymbol(e.SceneGraph, location) End If Next Dim soloPointLast As Boolean = currentSeries.Points.Count > 1 AndAlso Not currentSeries.Points(currentSeries.Points.Count - 1).Empty AndAlso currentSeries.Points(currentSeries.Points.Count - 2).Empty If soloPointLast Then Dim location As New Point(xAxis.Map(currentSeries.Points.Count - 1), yAxis.Map(currentSeries.Points(currentSeries.Points.Count - 1).Value)) Me.AddSymbol(e.SceneGraph, location) End If Next End If Next End Sub Private Sub AddSymbol(ByVal scene As SceneGraph, ByVal location As Point) Dim mySymbol As New Symbol(location, SymbolIcon.Circle, SymbolIconSize.Small) mySymbol.PE.ElementType = PaintElementType.SolidFill mySymbol.PE.Fill = Color.Red mySymbol.PE.Stroke = Color.Red scene.Add(mySymbol) End Sub
Tanks for the hint but i dont understand what you are trying to tell me
In fact I dont know how to use LineChart.LineAppearances
Remember that I use UltraWinChart.UltraChart grphic type component
How can I use your LineChart.LineAppearances with this type of component
See what I use to configure this Chart what should I change or add
Thanks in advance!
-----------------------------------------------------------------
'first, we have to clear the chart layers
chtMainGraph.CompositeChart.ChartAreas.Clear()
chtMainGraph.CompositeChart.ChartLayers.Clear()
= 0
Double
dttmp1 =
DataTable()
dttmp2 =
dttmp1 = oCurrentGraph.GetData()
dttmp2 = oCurrentGraph.GetSecondaryData()
'calculation of the highest value for the two Y axes
dttmp1.Rows
Then
highestvaldttmp1 = orow(1)
If
Next
dttmp2.Rows
highestvaldttmp2 = orow(1)
'we put add 5% of the maximum value for each Y axes
highestvaldttmp1 = highestvaldttmp1 + ((highestvaldttmp1 * 5) / 100)
highestvaldttmp1 = RoundToUpperPrecision(highestvaldttmp1, 10)
highestYval = highestvaldttmp1
Else
highestYval = highestvaldttmp2
highestYval = RoundToUpperPrecision(highestYval / Math.Pow(10, (highestYval.ToString.Length - 1)), 1) * Math.Pow(10, (highestYval.ToString.Length - 1))
'Creation of the compositelegend object and of the chart area object
UltraChart.Resources.Appearance.CompositeLegend()
Infragistics.UltraChart.Resources.Appearance.ChartArea
'sets the bounds measure type of the chart in the window
area1.BoundsMeasureType = UltraChart.Shared.Styles.MeasureType.Percentage
'we add the chart area to the ultra chart object
chtMainGraph.CompositeChart.ChartAreas.Add(area1)
'we create the axis and set their properties
Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.X_Axis)
xaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.X_Axis
xaxis.DataType = UltraChart.Shared.Styles.AxisDataType.String
xaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.ItemLabel
xaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData
xaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal
xaxis.RangeType = UltraChart.Shared.Styles.AxisRangeType.Automatic
xaxis.Visible =
True
Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.X2_Axis)
xaxis3.OrientationType = UltraChart.Shared.Styles.AxisNumber.X2_Axis
xaxis3.Extent = 30
xaxis3.LineThickness = 0
Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.Y_Axis)
yaxis.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y_Axis
yaxis.DataType = UltraChart.Shared.Styles.AxisDataType.Numeric
yaxis.Labels.ItemFormat = UltraChart.Shared.Styles.AxisItemLabelFormat.DataValue
yaxis.SetLabelAxisType = UltraChart.Core.Layers.SetLabelAxisType.ContinuousData
yaxis.Labels.Layout.Behavior = UltraChart.Shared.Styles.AxisLabelLayoutBehaviors.Auto
yaxis.Labels.Orientation = UltraChart.Shared.Styles.TextOrientation.Horizontal
yaxis.RangeType = UltraChart.Shared.Styles.AxisRangeType.Custom
yaxis.RangeMin = 0
'yaxis.RangeMax = highestYval
yaxis.RangeMax = RangeMaxY1
yaxis.RangeMax = highestYval
Infragistics.UltraChart.Resources.Appearance.AxisItem(chtMainGraph, UltraChart.Shared.Styles.AxisNumber.Y2_Axis)
yaxis2.OrientationType = UltraChart.Shared.Styles.AxisNumber.Y2_Axis
yaxis2.Extent = 200
yaxis2.LineThickness = 0
chtMainGraph.TitleRight.Extent = 200 - 40
'we use the composite chart that allow to use multiple style of chart in one
chtMainGraph.ChartType = UltraChart.Shared.Styles.ChartType.Composite
UltraChart.Resources.Appearance.NumericSeries
seriesLine.Label = dttmp1.Columns(1).ColumnName
seriesLine2.Label = dttmp2.Columns(1).ColumnName
UltraChart.Resources.Appearance.ChartLayerAppearance()
UltraChart.Resources.Appearance.SplineChartAppearance
UltraChart.Resources.Appearance.LineAppearance
line.Thickness = 3
line.LineStyle.DrawStyle = UltraChart.Shared.Styles.LineDrawStyle.Solid
line.IconAppearance.Icon = UltraChart.Shared.Styles.SymbolIcon.Circle
line.SplineTension = 0.5
SPlinechartappearance.LineAppearances.Add(line)
SPlinechartappearance.NullHandling = UltraChart.Shared.Styles.NullHandling.DontPlot
UltraChart.Resources.Appearance.LineChartAppearance()
UltraChart.Resources.Appearance.LineAppearance()
line2.Thickness = 3
line2.IconAppearance.Icon = UltraChart.Shared.Styles.SymbolIcon.None
line2.LineStyle.DrawStyle = UltraChart.Shared.Styles.LineDrawStyle.Solid
linechartappearance2.LineAppearances.Add(line2)
linechartappearance2.NullHandling = UltraChart.Shared.Styles.NullHandling.DontPlot
seriesLine.Data.DataSource = dttmp1
seriesLine.Data.LabelColumn = dttmp1.Columns(0).ColumnName
seriesLine.Data.ValueColumn = dttmp1.Columns(1).ColumnName
seriesLine.PEs.Add(
UltraChart.Resources.Appearance.PaintElement(Color.Blue))
seriesLine2.Data.DataSource = dttmp2
seriesLine2.Data.LabelColumn = dttmp2.Columns(0).ColumnName
seriesLine2.Data.ValueColumn = dttmp2.Columns(1).ColumnName
seriesLine2.PEs.Add(
UltraChart.Resources.Appearance.PaintElement(Color.Red))
appearanceLine.ChartType = UltraChart.Shared.Styles.ChartType.SplineChart
appearanceLine.ChartTypeAppearance = SPlinechartappearance
appearanceLine.ChartArea = area1
appearanceLine.Series.Add(seriesLine)
appearanceLine.AxisX = xaxis
appearanceLine.AxisY = yaxis
appearanceLine.LegendItem = UltraChart.Shared.Styles.LegendItemType.Series
appearanceLine2.ChartType = UltraChart.Shared.Styles.ChartType.LineChart
appearanceLine2.ChartTypeAppearance = linechartappearance2
appearanceLine2.ChartArea = area1
appearanceLine2.Series.Add(seriesLine2)
appearanceLine2.AxisX = xaxis
appearanceLine2.AxisY = yaxis
appearanceLine2.LegendItem = UltraChart.Shared.Styles.LegendItemType.Series
'we add the appearence layers to the chart
chtMainGraph.CompositeChart.ChartLayers.Add(appearanceLine)
chtMainGraph.CompositeChart.ChartLayers.Add(appearanceLine2)
'we add the appearence layers to the legend
compositeLegend.ChartLayers.Add(appearanceLine)
compositeLegend.ChartLayers.Add(appearanceLine2)
'' we set the properties to the legend
compositeLegend.BoundsMeasureType = UltraChart.Shared.Styles.MeasureType.Pixels
compositeLegend.Bounds =
Rectangle(chtMainGraph.Size.Width - 130, 100, 100, 5 + (2 * 15) + 5)
compositeLegend.ChartComponent = chtMainGraph.CompositeChart.ChartComponent
compositeLegend.PE.ElementType = UltraChart.Shared.Styles.PaintElementType.Gradient
compositeLegend.LabelStyle.Font =
, 10)
compositeLegend.PE.FillGradientStyle = UltraChart.Shared.Styles.GradientStyle.ForwardDiagonal
compositeLegend.PE.Fill = Color.CornflowerBlue
compositeLegend.PE.FillStopColor = Color.Transparent
compositeLegend.Border.CornerRadius = 10
compositeLegend.Border.Thickness = 0
'we clear the legend on the composite chart before adding the new one
chtMainGraph.CompositeChart.Legends.Clear()
chtMainGraph.CompositeChart.Legends.Add(compositeLegend)
'we add each created axes to the area
area1.Axes.Add(xaxis)
area1.Axes.Add(yaxis)
area1.Axes.Add(yaxis2)
area1.Axes.Add(xaxis3)
'we add the range for the series and refresh the layer
chtMainGraph.Series.AddRange(
Infragistics.UltraChart.Data.Series.ISeries() {seriesLine, seriesLine2})
try using the LineChart.LineAppearances collection to overlay symbols on the line. that will give you some representation of the null points.
For a test we put 0 instead of NULL and the point and the line was show in the Chart
The problem for me is that 0 mean there are no error find in the vérification that i have made.
But Null mean that there are not be any verification done at this time
So one solution is to take out all the row that have a Null value and the week for that Null value with not be display anymore in the graph. Well my client want to see those weeks with the Null Value :(
That is why I am here, to see if we can find another solution
So I wish you a nice day and if you think at something let me know
a++