Hi,
I have a problem to use a compositechart with several scatterchart. I want that scatterchart does not display a line between the points is null.I put NullHandling.DontPlot to NullHandling Option but that does not seem to function.
Can you help me.
Thanks.
Below part of the code :
lineLayer = new ChartLayerAppearance();
lineSeries = new XYSeries();
lineLayer.AxisX = aAxisX;
lineLayer.AxisY = aAxisY;
lineLayer.AxisX.Labels.ItemFormat = AxisItemLabelFormat.Custom;
lineLayer.AxisX.Labels.ItemFormatString = "<TIMESTAMP> ";
lineLayer.AxisX.DataType = AxisDataType.Numeric;
lineSeries.Data.DataSource = ds.Tables["DATA"];
lineSeries.Data.ValueXColumn ="TimeStamp";
lineSeries.Data.ValueYColumn = nom;
lineSeries.Label = nom +":" + unite;
PaintElement myPaintElement = new PaintElement(couleur);
myPaintElement.Hatch = Infragistics.UltraChart.Shared.Styles.
FillHatchStyle.Horizontal;
myPaintElement.StrokeWidth = epaisseur;
lineSeries.PEs.Add(myPaintElement);
lineLayer.ChartType = ChartType.ScatterChart;
((ScatterChartAppearance)(lineLayer.ChartTypeAppearance)).ConnectWithLines = true;
((ScatterChartAppearance)(lineLayer.ChartTypeAppearance)).NullHandling = NullHandling.DontPlot;
((ScatterChartAppearance)(lineLayer.ChartTypeAppearance)).Icon = (FormPrincipale.myParamLoc.AffichePointCourbe ? SymbolIcon.Circle : SymbolIcon.None);
((ScatterChartAppearance)(lineLayer.ChartTypeAppearance)).IconSize = SymbolIconSize.Small;
((ScatterChartAppearance)(lineLayer.ChartTypeAppearance)).LineAppearance.DrawStyle = LineDrawStyle.Solid;
((ScatterChartAppearance)(lineLayer.ChartTypeAppearance)).LineAppearance.SplineTension = (float)0;
((ScatterChartAppearance)(lineLayer.ChartTypeAppearance)).LineAppearance.Thickness = epaisseur;
lineLayer.Series.Add(lineSeries);
lineLayer.ChartArea = area;
chart.CompositeChart.ChartLayers.Add(lineLayer);
chart.CompositeChart.Series.Add(lineSeries);
Looking at the ScatterLayer source when a point is encountered as null and NullHandling is set to DontPlot the point is removed entirely from the plotted points. With ConnectLines set to true, line segments are then drawn between all the points that exist. So as it stands now there would be no gap where the null was encountered. Please bear with me as I'm looking into what we can do to remedy this or provide you with some sort of workaround.
nHi,
When using NullHandling.DontPlot the point is removed from the PointSet and a PolyLine is created to draw a line to each point in the PointSet. There will not be a gap when a null is encountered. Instead you can set ConectWithLines to false and draw the polyline yourself. An easy way to get a PointSet for each non-null segment is to set the NullHandling to Zero and as a result a PointSet will be created for each segment. Then you can add a PolyLine for each PointSet (segment). I attached an example chart that does this based upon the code you previously posted using a CompositeChart with a ScatterChart layer added.
Did you get a chance to check out the sample and get it working for you?
Thank you for your answer, it's ok.
Bye
An additional note on that workaround is you would have to set the clip of the appropriate graphics contexts to make sure the points and the grid lines don't go out of the new bounds as well.
Ah you must be using a margin on one of the axis... You will need to workaround that by either not setting the margin on the axis or in FillSceneGraph event handler do this as well as the other stuff we put in there before:
Infragistics.UltraChart.Core.Primitives.GraphicsContext graphicsContext;
for (int i = scene.Count - 1; i > 0; i--) { // find the graphics used for the polyline graphicsContext = scene[i] as Infragistics.UltraChart.Core.Primitives.GraphicsContext; if (graphicsContext != null) { System.Drawing.Rectangle rectangle = graphicsContext.GetClipBounds(); // set the graphics clip bounds to the innerbound of the chart area rectangle = this.ultraChart1.CompositeChart.ChartAreas[0].InnerBounds; double axisMargin = this.axisY.Margin.Far.Value; if (axisMargin != 0.0) { // need to adjust for margins hard-coded for example rectangle.Y = rectangle.Height / 2 + 10; rectangle.Height = rectangle.Height / 2 + 10; } // set the clip graphicsContext.SetClipBounds(rectangle); break; } }
// make sure the chart rerenders its layers now that we've messed with them. this.ultraChart1.InvalidateLayers();
My version of ultraWinChart dll is V12.2, I attache a example of problem.
Thanks
The example didn't attach. I know there were some bugs in the past about the zoom not properly taking line segments out of the rendering but I believe I fixed all those. What version are you using? Can you attach a sample and a screenshot showing what part is rendering incorrectly?