This project is read-only.

How to remove the PointMarks from the screen

Nov 19, 2008 at 12:44 PM



I’ve modified a static load point to dynamic load point from your sample “TooltipSample” and found a problem. I don’t know how to remove the points from the grid. Everytime I zoom in and zoom out, the points stay on screen. And it keeps on growing more and more.


Here is the code:

public partial class Window1 : Window<o:p></o:p>


        const int N = 100;<o:p></o:p>

        double[] x = new double[N];<o:p></o:p>

        double[] y = new double[N];<o:p></o:p>

        EnumerableDataSource<double> xDataSource = null;<o:p></o:p>

        EnumerableDataSource<double> yDataSource = null;<o:p></o:p>

        CompositeDataSource compositeDataSource;<o:p></o:p>

        public Window1()<o:p></o:p>



            // Prepare data in arrays<o:p></o:p>

            //for (int i = 0; i < N; i++)<o:p></o:p>


            //    x[i] = i * 0.1;<o:p></o:p>

            //    y[i] = Math.Sin(x[i]);<o:p></o:p>


            // Add data sources:<o:p></o:p>

            yDataSource = new EnumerableDataSource<double>(y);<o:p></o:p>

            yDataSource.SetYMapping(Y => Y);<o:p></o:p>


                Y => string.Format("Value is {0}", Y));<o:p></o:p>

            xDataSource = new EnumerableDataSource<double>(x);<o:p></o:p>

            xDataSource.SetXMapping(X => X);<o:p></o:p>


            //    X => string.Format("Value is {0}", X));<o:p></o:p>

            compositeDataSource = new CompositeDataSource(xDataSource, yDataSource); <o:p></o:p>

            // adding graph to plotter<o:p></o:p>


                new Pen(Brushes.Goldenrod,3),<o:p></o:p>

                new CircleElementPointMarker(),<o:p></o:p>

                new PenDescription("Cosine")); <o:p></o:p>

            // Force evertyhing plotted to be visible<o:p></o:p>



        int i = 0;<o:p></o:p>

        private void button1_Click(object sender, RoutedEventArgs e)<o:p></o:p>


            if ( i < N)<o:p></o:p>


                x[i] = i * 0.2;<o:p></o:p>

                y[i] = Math.Cos(x[i]);<o:p></o:p>

                i++; <o:p></o:p>




            //var xDataSource = new EnumerableDataSource<double>(x);<o:p></o:p>

            //xDataSource.SetXMapping(X => X);<o:p></o:p>