Hello,
I was wondering if it's possible to create a line chart with no lines... as in... the data is there & plotted but only the data points are visible and not the lines that connect them.
The x axis is a date so we cannot use a scatter chart.
Can someone please tell me if this is possible, and if so, how to do it? I've gone through the properties of the chart and can't find a way to turn the drawing of the line off! It would be nice if I could just set the DrawStyle to none, or something like that, but that option isn't available :(
Please help!
You'll have to handle FillSceneGraph event, add a symbol icon at each of your line's point location and then set your lines to be transparent. Something like this:private void ultraChart1_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e){ PrimitiveCollection symbols = new PrimitiveCollection(); foreach (Primitive p in e.SceneGraph) { Polyline polyline = p as Polyline; if (polyline != null) { polyline.PE.Fill = Color.Transparent; foreach (DataPoint dataPoint in polyline.points) { Symbol symbol = new Symbol(); symbol.icon = SymbolIcon.Circle; symbol.iconSize = SymbolIconSize.Medium; symbol.PE.Fill = Color.Red; symbol.point = dataPoint.point; symbols.Add(symbol); } } }
e.SceneGraph.AddRange(symbols.ToArray());}
Hey,
So although I got everything working fine initially, I now have a new requirement whereby all lines are to remain as lines (and therefore not be transparent as they previously wanted) EXCEPT for ONE line. One line is to be transparent.
Using the code in the post above, I can't figure out how to determine which line needs to be transparent and which one doesn't. The format of my data set which is being bound to the chart is as follows:
I figure if, inside FillSceneGraph I could get access to the value in the title column (which is being displayed in the Legend) I would then be able to determine whether I want to keep the colour of the line as it is, or change it to transparent. However, this information doesn't seem to be available at this point. Any suggestions?
I think an even better approach is to use the title string to locate the row number in the datasource itself, without having to go through the legend. Each line is represented by a Polyline primitive. If you pick the polyline, where polyline.Row matches the row number you previously found in your datasource, you will be able to make that polyline transparent by setting PE.Fill to Transparent.
What I ended up doing was moving away from simply data binding the chart and instead I am creating series and adding the series to the chart. Since it's a full series that I want to make transparent, while the other series' keep their lines, I can now access the properties of the series from within FillSceneGraph and can use those properties to determine whether each point is part of the 'transparent' or 'non-transparent' series.
Although I believe this gives me a bit more control over what's happening in the chart, it's caused one additional issue, being that when we were simply data binding the chart, the icons in the legend were little coloured squares no matter what chart type we were using (our chart toggles between line and column), but now that we're adding the series ourselves, the icon in the legend is a little line when we're using a line chart and a little coloured square when it's a column chart. Although this makes sense, it's against the requirements we were given and I can't figure out how to change it back to be the little coloured square :S
alannaw said:Although this makes sense, it's against the requirements we were given and I can't figure out how to change it back to be the little coloured square :S
i believe the only way to override this behavior is to handle the FillSceneGraph event, look for those Polyline objects inside your legend, and overlay Boxes (Infragistics.UltraChart.Core.Primitives.Box) on top of them.