Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
345
Controling ScatterLine line appearance
posted

Hi,

I have a ScatterLine chart with multiple data series. I want to be able to control the appearance of the lines in the chart based on the data. The data provides a series of points (which I plot successfully) and also attributes for each point which I want reflected in the color of the point and the thickness of the line segement.

I have tried using the ChartDrawItem event to modify the PE properties but cannot seem to get this to work. I used the following code (largely cut and paste from an earlier post)

This method is triggered by the charts ChartDrawItem event.

Any suggestions on what I am missing?

thx

l.

 

 

        private void ultraChart1_ChartDrawItem(object sender, Infragistics.UltraChart.Shared.Events.ChartDrawItemEventArgs e)

        {

            if (e.Primitive is Polyline)

            {

                Polyline pl = (Polyline)e.Primitive;

                for (int x = 0; x < pl.points.Length; x++)

                {

                    try

                    {

                        if (Convert.ToDouble(pl.points[x].Value) < 0)

                        {

                            e.Primitive.PE.Fill = Color.Red;

                            e.Primitive.PE.Stroke = Color.Red;

                            e.Primitive.PE.StrokeWidth = e.Primitive.PE.StrokeWidth * 20;

                        }

                    }

                    catch { }

                    finally { }

                }

            }

        }