示例#1
0
 public Basechart(Dispatcher p, ChartPlotter newchart, Dictionary<string, string> packagelist)
 {
     //Init variables
     colorpool.Add(Colors.Blue);
     colorpool.Add(Colors.Red);
     colorpool.Add(Colors.Green);
     colorpool.Add(Colors.Yellow);
     colorpool.Add(Colors.Pink);
     disp = p;
     chart = newchart;
     msr.Width = 300;
     this.chart.Viewport.Restrictions.Add(msr);
     //chart.MainVerticalAxis.
     chart.FitToView();
     //chart.Legend.LegendLeft = 10.0;
     chart.MouseMove += new MouseEventHandler(chart_MouseMove);
     chart.MouseLeave += new MouseEventHandler(chart_MouseLeave);
     chart.LegendVisibility = Visibility.Hidden;
     //pkglist = packagelist;
     //datalist = new Dictionary<string, ObservableDataSource<Point>>();
     ThreadStart ts = new ThreadStart(asyncProcData);
     newThread = new Thread(ts);
     newThread.Start();
 }
示例#2
0
        void Page_Loaded(object sender, RoutedEventArgs e)
        {
            //Creating plotter without a legend and button navigation
            ChartPlotterSettings settings = new ChartPlotterSettings();
            settings.IsButtonNavigationPresents = false;
            settings.IsLegendPresents = false;
            mainPlotter = new ChartPlotter(settings);
            RootStackPanel.Children.Add(mainPlotter);

            //Adding legened to custom location
            legend = new Legend(mainPlotter);
            //Wrapper to provide easy usage of the legend if it is too big
            ScrollWraper wraper = new ScrollWraper(legend);
            RootStackPanel.Children.Insert(0,wraper);

            //Adding custom buttons to plotter hovering panel
            buttonAdd = new Button() { Content="Add random polynomial"};
            buttonAdd.Click+=new RoutedEventHandler(ButtonAddClick);
            buttonClear = new Button() { Content="Remove all charts"};
            buttonClear.Click +=new RoutedEventHandler(ButtonClearClick);
            StackPanel internalStackPanel = new StackPanel() { Orientation = Orientation.Vertical, Margin= new Thickness(5) };
            internalStackPanel.Children.Add(buttonAdd);
            internalStackPanel.Children.Add(buttonClear);
            mainPlotter.HoveringStackPanel.Children.Add(internalStackPanel);

            //Adding button navigation to custom location
            Microsoft.Research.DynamicDataDisplay.Navigation.buttonsNavigation n =
                new Microsoft.Research.DynamicDataDisplay.Navigation.buttonsNavigation(mainPlotter);
            RootStackPanel.Children.Add(n);

            //Adding some data to the plotter
            for (int i = 0; i < 10; i++)
                addRandomPolynomial();
            
            mainPlotter.FitToView();
        }