void MainWindow_Loaded(object sender, RoutedEventArgs e) { //lineChart.ItemsSource = new Func<double, double>(i => Math.Sin(i * 10)); //plotter.MainHorizontalAxis = null; //plotter.Children.Remove(plotter.MainHorizontalAxis); var axis = new HorizontalAxis(); plotter.Children.Add(axis); CustomBaseNumericTicksProvider ticksProvider = new CustomBaseNumericTicksProvider(Math.PI); CustomBaseNumericLabelProvider labelProvider = new CustomBaseNumericLabelProvider(Math.PI, "π"); axis.LabelProvider = labelProvider; axis.TicksProvider = ticksProvider; for (int i = 0; i < count; i++) { data.Add(new Point(i, Math.Sin(i / 10))); } LineChart chart = new LineChart { ItemsSource = data, StrokeThickness = 3 }; plotter.Children.Add(chart); List<double> xs = Enumerable.Range(0, count).Select(i => (double)i).ToList(); List<double> ys = Enumerable.Range(0, count).Select(i => Math.Sin(i / 10.0)).ToList(); xAndYSeqChart.DataSource = DataSource.Create(xs, ys); }
void MainWindow_Loaded(object sender, RoutedEventArgs e) { //lineChart.ItemsSource = new Func<double, double>(i => Math.Sin(i * 10)); //plotter.MainHorizontalAxis = null; //plotter.Children.Remove(plotter.MainHorizontalAxis); var axis = new HorizontalAxis(); plotter.Children.Add(axis); CustomBaseNumericTicksProvider ticksProvider = new CustomBaseNumericTicksProvider(Math.PI); CustomBaseNumericLabelProvider labelProvider = new CustomBaseNumericLabelProvider(Math.PI, "π"); axis.LabelProvider = labelProvider; axis.TicksProvider = ticksProvider; for (int i = 0; i < count; i++) { data.Add(new Point(i, Math.Sin(i / 10))); } LineChart chart = new LineChart { ItemsSource = data, StrokeThickness = 3 }; plotter.Children.Add(chart); List <double> xs = Enumerable.Range(0, count).Select(i => (double)i).ToList(); List <double> ys = Enumerable.Range(0, count).Select(i => Math.Sin(i / 10.0)).ToList(); xAndYSeqChart.DataSource = DataSource.Create(xs, ys); }
private void SetupOneThirdAxis() { HorizontalAxis axis = new HorizontalAxis(); CustomBaseNumericTicksProvider ticksProvider = new CustomBaseNumericTicksProvider(0.5); CustomBaseNumericLabelProvider labelProvider = new CustomBaseNumericLabelProvider(0.5, "·½"); axis.LabelProvider = labelProvider; axis.TicksProvider = ticksProvider; plotter.Children.Add(axis); }
private void SetupPiAxis() { HorizontalAxis axis = new HorizontalAxis(); CustomBaseNumericTicksProvider ticksProvider = new CustomBaseNumericTicksProvider(Math.PI); CustomBaseNumericLabelProvider labelProvider = new CustomBaseNumericLabelProvider(Math.PI, "π"); axis.LabelProvider = labelProvider; axis.TicksProvider = ticksProvider; plotter.Children.Add(axis); }
public Window2() { InitializeComponent(); plotter.MainVerticalAxis.Placement = AxisPlacement.Right; //dateAxis.SetConversion(0, new DateTime(2008, 1, 1), 1, new DateTime(2008, 12, 1)); //dateAxis.LabelProvider += LabelProvider_LabelCreated; horizTimeAxis.SetConversion(0, new TimeSpan(), 1, TimeSpan.FromHours(1)); vertTimeAxis.SetConversion(0, new TimeSpan(), 1, TimeSpan.FromDays(1)); //horizDateAxis.SetConversion(0, new DateTime(2008, 1, 1), 1, new DateTime(2008, 12, 1)); //vertDateAxis.SetConversion(0, new DateTime(2008, 1, 1), 1, new DateTime(2008, 12, 1)); //TypifiedChartPlotter<double, double> pl1 = new TypifiedChartPlotter<double, double>(); //pl1.HorizontalAxis = new HorizontalTimeSpanAxis(); HorizontalAxis axis = new HorizontalAxis(); List<CityInfo> cities = new List<CityInfo> { new CityInfo{ Name = "Paris", Coordinate = -3}, new CityInfo{ Name = "Berlin", Coordinate = -1.9}, new CityInfo{ Name = "Minsk", Coordinate = -0.8}, new CityInfo{ Name = "Moscow", Coordinate = 0}, new CityInfo{ Name = "Perm", Coordinate = 2}, new CityInfo{ Name = "Ekaterinburg", Coordinate = 4}, new CityInfo{ Name = "Vladivostok", Coordinate = 9} }; GenericLocationalLabelProvider<CityInfo, double> labelProvider = new GenericLocationalLabelProvider<CityInfo, double>(cities, city => city.Name); labelProvider.SetCustomView((li, uiElement) => { FrameworkElement element = (FrameworkElement)uiElement; element.LayoutTransform = new RotateTransform(-45, 1, 0); }); GenericLocationalTicksProvider<CityInfo, double> ticksProvider = new GenericLocationalTicksProvider<CityInfo, double>(cities, city => city.Coordinate); axis.LabelProvider = labelProvider; axis.TicksProvider = ticksProvider; plotter.Children.Add(axis); HorizontalAxis axis2 = new HorizontalAxis(); CustomBaseNumericTicksProvider provider2 = new CustomBaseNumericTicksProvider(Math.PI); CustomBaseNumericLabelProvider labelProvider2 = new CustomBaseNumericLabelProvider(Math.PI, "π"); axis2.LabelProvider = labelProvider2; axis2.TicksProvider = provider2; plotter.Children.Add(axis2); }
public Window2() { InitializeComponent(); plotter.MainVerticalAxis.Placement = AxisPlacement.Right; //dateAxis.SetConversion(0, new DateTime(2008, 1, 1), 1, new DateTime(2008, 12, 1)); //dateAxis.LabelProvider += LabelProvider_LabelCreated; horizTimeAxis.SetConversion(0, new TimeSpan(), 1, TimeSpan.FromHours(1)); vertTimeAxis.SetConversion(0, new TimeSpan(), 1, TimeSpan.FromDays(1)); //horizDateAxis.SetConversion(0, new DateTime(2008, 1, 1), 1, new DateTime(2008, 12, 1)); //vertDateAxis.SetConversion(0, new DateTime(2008, 1, 1), 1, new DateTime(2008, 12, 1)); //TypifiedChartPlotter<double, double> pl1 = new TypifiedChartPlotter<double, double>(); //pl1.HorizontalAxis = new HorizontalTimeSpanAxis(); HorizontalAxis axis = new HorizontalAxis(); List <CityInfo> cities = new List <CityInfo> { new CityInfo { Name = "Paris", Coordinate = -3 }, new CityInfo { Name = "Berlin", Coordinate = -1.9 }, new CityInfo { Name = "Minsk", Coordinate = -0.8 }, new CityInfo { Name = "Moscow", Coordinate = 0 }, new CityInfo { Name = "Perm", Coordinate = 2 }, new CityInfo { Name = "Ekaterinburg", Coordinate = 4 }, new CityInfo { Name = "Vladivostok", Coordinate = 9 } }; GenericLocationalLabelProvider <CityInfo, double> labelProvider = new GenericLocationalLabelProvider <CityInfo, double>(cities, city => city.Name); labelProvider.SetCustomView((li, uiElement) => { FrameworkElement element = (FrameworkElement)uiElement; element.LayoutTransform = new RotateTransform(-45, 1, 0); }); GenericLocationalTicksProvider <CityInfo, double> ticksProvider = new GenericLocationalTicksProvider <CityInfo, double>(cities, city => city.Coordinate); axis.LabelProvider = labelProvider; axis.TicksProvider = ticksProvider; plotter.Children.Add(axis); HorizontalAxis axis2 = new HorizontalAxis(); CustomBaseNumericTicksProvider provider2 = new CustomBaseNumericTicksProvider(Math.PI); CustomBaseNumericLabelProvider labelProvider2 = new CustomBaseNumericLabelProvider(Math.PI, "π"); axis2.LabelProvider = labelProvider2; axis2.TicksProvider = provider2; plotter.Children.Add(axis2); }
public MinorProviderWrapper(CustomBaseNumericTicksProvider owner) { this.owner = owner; MinorTicksProvider.Changed += MinorTicksProvider_Changed; }