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(); }
private void ChartPlotter_Loaded(object sender, RoutedEventArgs e) { if (!alreadyLoaded) { VerticalAxis = new VerticalAxis(); #region Different initialization if (settings.HorizontalAxisType == ChartPlotterSettings.AxisType.NumericAxis) { var h = new HorizontalAxis(); HorizontalAxis =h; } else HorizontalAxis = new HorizontalDateTimeAxis(); if (settings.IsButtonNavigationPresents) { buttonsNavigation = new buttonsNavigation(this); HoveringStackPanel.Children.Add(buttonsNavigation); } if (settings.IsLegendPresents) { legend = new Legend(this); ScrollWraper legendWraper = new ScrollWraper(legend); legendWraper.Margin = new Thickness(5, 10, 10, 10); HoveringStackPanel.Children.Add(legendWraper); } #endregion Children.Add(axisGrid); if (mouseNavigation!=null) Children.Add(mouseNavigation); MainCanvas.SizeChanged += new SizeChangedEventHandler(MainCanvas_SizeChanged); HoveringStackPanel.SizeChanged += new SizeChangedEventHandler(hoveringPanel_SizeChanged); Viewport.FitToView(); alreadyLoaded = true; } }