public BaseChart() { Background = new SolidColorBrush(Colors.White); VerticalAxis = new LinearAxis(); HorizontalAxis = new CategoricalAxis { SmartLabelsMode = AxisSmartLabelsMode.SmartStep, LabelFitMode = AxisLabelFitMode.Rotate, LabelRotationAngle = 270 }; ChartTrackBallBehavior chartTrackBallBehavior = new ChartTrackBallBehavior { ShowIntersectionPoints = true, ShowTrackInfo = true, }; //System.Windows.Point position = chartTrackBallBehavior.Position; //position.X = (23); //position.Y = (45); //chartTrackBallBehavior.Position = position; ChartPanAndZoomBehavior panAndZoomBehavior = new ChartPanAndZoomBehavior { ZoomMode = ChartPanZoomMode.Both, PanMode = ChartPanZoomMode.Both }; Behaviors.Add(panAndZoomBehavior); Behaviors.Add(chartTrackBallBehavior); }
private RadCartesianChartView createChart(){ //Create the Chart View RadCartesianChartView chart = new RadCartesianChartView(this.Activity); //Create the area series and attach axes and value bindings. AreaSeries areaSeries = new AreaSeries(); areaSeries.ValueBinding = new ValueBinding(); areaSeries.CategoryBinding = new CategoryBinding(); LinearAxis verticalAxis = new LinearAxis(); //The values in the linear axis will not have values after the decimal point. verticalAxis.LabelFormat = "%.0f"; CategoricalAxis horizontalAxis = new CategoricalAxis(); horizontalAxis.LabelInterval = 10; horizontalAxis.LabelFitMode = AxisLabelFitMode.MultiLine; areaSeries.VerticalAxis = verticalAxis; areaSeries.HorizontalAxis = horizontalAxis; //Bind series to data areaSeries.Data = this.getData(); //Add series to chart chart.Series.Add(areaSeries); ChartPanAndZoomBehavior pzBehavior = new ChartPanAndZoomBehavior(); pzBehavior.PanMode = ChartPanZoomMode.Both; pzBehavior.ZoomMode = ChartPanZoomMode.Both; chart.Behaviors.Add(pzBehavior); return chart; }
private void toggleOption_Click(object sender, EventArgs e) { ChartPanAndZoomBehavior b = chart1.Behaviors.ElementAt(0) as ChartPanAndZoomBehavior; ChartPanAndZoomBehavior b2 = chart2.Behaviors.ElementAt(0) as ChartPanAndZoomBehavior; ChartPanAndZoomBehavior b3 = chart3.Behaviors.ElementAt(0) as ChartPanAndZoomBehavior; ChartPanAndZoomBehavior b4 = chart4.Behaviors.ElementAt(0) as ChartPanAndZoomBehavior; ChartPanAndZoomBehavior b5 = chart5.Behaviors.ElementAt(0) as ChartPanAndZoomBehavior; ChartPanAndZoomBehavior b6 = chart6.Behaviors.ElementAt(0) as ChartPanAndZoomBehavior; ChartPanAndZoomBehavior b7 = chart7.Behaviors.ElementAt(0) as ChartPanAndZoomBehavior; ChartPanAndZoomBehavior b8 = chart8.Behaviors.ElementAt(0) as ChartPanAndZoomBehavior; if (b.PanMode == ChartPanZoomMode.Horizontal) { b.PanMode = ChartPanZoomMode.None; b.ZoomMode = ChartPanZoomMode.None; ((ApplicationBarIconButton)ApplicationBar.Buttons[3]).IconUri = new Uri("/Images/flurryst_icon_bar_zoom.png", UriKind.Relative); } else { b.PanMode = ChartPanZoomMode.Horizontal; b.ZoomMode = ChartPanZoomMode.Horizontal; ((ApplicationBarIconButton)ApplicationBar.Buttons[3]).IconUri = new Uri("/Images/flurryst_icon_bar_zoomcancel.png", UriKind.Relative); } b2.ZoomMode = b.ZoomMode; b2.PanMode = b.PanMode; b3.ZoomMode = b.ZoomMode; b3.PanMode = b.PanMode; b4.ZoomMode = b.ZoomMode; b4.PanMode = b.PanMode; b5.ZoomMode = b.ZoomMode; b5.PanMode = b.PanMode; b6.ZoomMode = b.ZoomMode; b6.PanMode = b.PanMode; b7.ZoomMode = b.ZoomMode; b7.PanMode = b.PanMode; b8.ZoomMode = b.ZoomMode; b8.PanMode = b.PanMode; }
private RadCartesianChartView createChart() { //Create the Chart View RadCartesianChartView chart = new RadCartesianChartView(this.Activity); //Create the area series and attach axes and value bindings. AreaSeries areaSeries = new AreaSeries(); areaSeries.ValueBinding = new ValueBinding(); areaSeries.CategoryBinding = new CategoryBinding(); LinearAxis verticalAxis = new LinearAxis(); //The values in the linear axis will not have values after the decimal point. verticalAxis.LabelFormat = "%.0f"; CategoricalAxis horizontalAxis = new CategoricalAxis(); horizontalAxis.LabelInterval = 10; horizontalAxis.LabelFitMode = AxisLabelFitMode.MultiLine; areaSeries.VerticalAxis = verticalAxis; areaSeries.HorizontalAxis = horizontalAxis; //Bind series to data areaSeries.Data = this.getData(); //Add series to chart chart.Series.Add(areaSeries); ChartPanAndZoomBehavior pzBehavior = new ChartPanAndZoomBehavior(); pzBehavior.PanMode = ChartPanZoomMode.Both; pzBehavior.ZoomMode = ChartPanZoomMode.Both; chart.Behaviors.Add(pzBehavior); return(chart); }
public MainWindow() { InitializeComponent(); RadCartesianChart chart = new RadCartesianChart(); CategoricalAxis catAxis = new CategoricalAxis(); LinearAxis lineAxis = new LinearAxis(); chart.HorizontalAxis = catAxis; chart.VerticalAxis = lineAxis; ChartPanAndZoomBehavior c = new ChartPanAndZoomBehavior(); c.ZoomMode = ChartPanZoomMode.Both; c.PanMode = ChartPanZoomMode.Both; chart.Behaviors.Add(c); LineSeries barSeries = new LineSeries(); barSeries.DataPoints.Add(new CategoricalDataPoint() { Category = "Apples", Value = 2 }); barSeries.DataPoints.Add(new CategoricalDataPoint() { Category = "Bananas", Value = 28 }); barSeries.DataPoints.Add(new CategoricalDataPoint() { Category = "Oranges", Value = 17 }); barSeries.DataPoints.Add(new CategoricalDataPoint() { Category = "Strawberries", Value = 30 }); chart.Series.Add(barSeries); G.Children.Add(chart); }
private void ZoomToggleButton_Click_1(object sender, RoutedEventArgs e) { RadCartesianChart[] targetCharts = { radChart1, radChart2, radChart3, radChart4 , radChart5, radChart6, radChart7, radChart8 }; if (flipView1.SelectedIndex < 8) { RadCartesianChart targetChart = targetCharts[flipView1.SelectedIndex]; //foreach (RadCartesianChart targetChart in targetCharts) // { if (targetChart.Behaviors.Count > 0) { // disable chart behaviour Debug.WriteLine("Disable chart behaviour: " + targetChart.Behaviors.Count); //ChartPanAndZoomBehavior item1 = targetChart.Behaviors[0] as ChartPanAndZoomBehavior; //ChartTrackBallBehavior item2 = targetChart.Behaviors[1] as ChartTrackBallBehavior; try { targetChart.Behaviors.Clear(); } catch (System.ArgumentException) { Debug.WriteLine("ArgumentException"); } //if (item2 != null) { targetChart.Behaviors.Remove(item2); } //if (item1 != null) { targetChart.Behaviors.Remove(item1); } targetChart.IsHitTestVisible = false; targetChart.Zoom = new Size(1, 1); } else { // enable Debug.WriteLine("Enable chart behaviour: " + targetChart.Behaviors.Count); ChartPanAndZoomBehavior item1 = new ChartPanAndZoomBehavior(); item1.ZoomMode = ChartPanZoomMode.Horizontal; item1.PanMode = ChartPanZoomMode.Horizontal; targetChart.Behaviors.Add(item1); ChartTrackBallBehavior item2 = new ChartTrackBallBehavior(); item2.ShowIntersectionPoints = true; item2.InfoMode = TrackInfoMode.Multiple; item2.TrackInfoUpdated += ChartTrackBallBehavior_TrackInfoUpdated_1; item2.ShowInfo = true; targetChart.Behaviors.Add(item2); } // enabling chart behaviours //} pageRoot.BottomAppBar.IsOpen = false; // close it ZoomToggleSetVisibility(flipView1.SelectedIndex); } }