protected ChartDataBinder(BaseChartView <TX, TY> view, ViewType viewType, bool allowZoom = true) { _view = view; _viewType = viewType; _allowZoom = allowZoom; _symbolMapper = new SymbolToMarkerKindMapper(); _lineStyleMapper = new LineStyleToDashStyleMapper(); }
protected ChartDataBinder(BaseChartView <TX, TY> view, ViewType viewType, bool allowZoom = true) { _view = view; _viewType = viewType; _allowZoom = allowZoom; _symbolMapper = new SymbolToMarkerKindMapper(); _lineStyleMapper = new LineStyleToDashStyleMapper(); if (_allowZoom) { _diagramZoomRectangleService = new DiagramZoomRectangleService(_view.Chart, zoomAction); } }
private async void OnContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args) { if (args.InRecycleQueue) { return; } var root = args.ItemContainer.ContentTemplateRoot as HeaderedControl; var data = args.Item as ChartViewData; var border = root.Items[0] as AspectView; var checks = root.Items[1] as WrapPanel; if (args.Phase < 2) { root.Header = data.title; border.Children.Clear(); args.RegisterUpdateCallback(2, OnContainerContentChanging); return; } border.Constraint = data; if (data.token != null) { if (data.title == Strings.Resources.LanguagesChartTitle) { System.Diagnostics.Debugger.Break(); } await data.LoadAsync(ViewModel.ProtoService, ViewModel.Chat.Id); } //if (args.ItemIndex != _loadIndex) //{ // root.Header = data.title; // return; //} BaseChartView chartView = null; //BaseChartView zoomedChartView = null; switch (data.graphType) { case 1: chartView = new DoubleLinearChartView(); //zoomedChartView = new DoubleLinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 2: chartView = new StackBarChartView(); //zoomedChartView = new StackBarChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 3: chartView = new BarChartView(); //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 4: chartView = new StackLinearChartView(); //chartView.legendSignatureView.showPercentage = true; //zoomedChartView = new PieChartView(); break; case 5: chartView = new StepChartView(); //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 6: chartView = new DoubleStepChartView(); //zoomedChartView = new DoubleLinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; default: chartView = new LinearChartView(); //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; } root.Header = data.title; border.Children.Clear(); border.Children.Add(chartView); checks.Children.Clear(); chartView.Loaded += (s, myargs) => { chartView.SetDataPublic(data.chartData); var lines = chartView.GetLines(); if (lines.Count > 1) { foreach (var line in lines) { var check = new FauxCheckBox(); check.Style = Resources["LineCheckBoxStyle"] as Style; check.Content = line.line.name; check.IsChecked = line.enabled; check.Background = new SolidColorBrush(line.lineColor); check.Margin = new Thickness(12, 0, 0, 12); check.DataContext = line; check.Tag = chartView; check.Click += CheckBox_Checked; checks.Children.Add(check); } checks.Visibility = Visibility.Visible; } else { checks.Visibility = Visibility.Collapsed; } }; }
public void zoomOut(BaseChartView chartView, bool animated) { Back.Visibility = Visibility.Collapsed; }
public void zoomTo(BaseChartView zoomedChartView, long d, bool v) { Back.Visibility = Visibility.Visible; }
public void UpdateData(ChartViewData data) { //if (args.ItemIndex != _loadIndex) //{ // root.Header = data.title; // return; //} BaseChartView chartView = null; BaseChartView zoomedChartView = null; switch (data.graphType) { case 1: chartView = new DoubleLinearChartView(); //zoomedChartView = new DoubleLinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 2: chartView = new StackBarChartView(); //zoomedChartView = new StackBarChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 3: chartView = new BarChartView(); //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 4: chartView = new StackLinearChartView(); chartView.legendSignatureView.showPercentage = true; //zoomedChartView = new PieChartView(); break; case 5: chartView = new StepChartView(); chartView.legendSignatureView.isTopHourChart = true; //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; case 6: chartView = new DoubleStepChartView(); //zoomedChartView = new DoubleLinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; default: chartView = new LinearChartView(); //zoomedChartView = new LinearChartView(); //zoomedChartView.legendSignatureView.useHour = true; break; } LayoutRoot.Children.Clear(); LayoutRoot.Children.Add(chartView); this.data = data; this.chartView = chartView; this.zoomedChartView = zoomedChartView; if (zoomedChartView != null) { chartView.Tapped += (s, args) => { OnZoomed(); }; chartHeaderView.Click += (s, args) => { ZoomOut(true); }; LayoutRoot.Children.Add(zoomedChartView); zoomedChartView.Visibility = Visibility.Collapsed; } CheckPanel.Children.Clear(); chartView.SetHeader(chartView.legendSignatureView.isTopHourChart ? null : chartHeaderView); chartView.Loaded += (s, args) => { chartView.SetDataPublic(data.chartData); var lines = chartView.GetLines(); if (lines.Count > 1) { foreach (var line in lines) { var check = new FauxCheckBox(); check.Style = BootStrapper.Current.Resources["LineCheckBoxStyle"] as Style; check.Content = line.line.name; check.IsChecked = line.enabled; check.Background = new SolidColorBrush(line.lineColor); check.Margin = new Thickness(12, 0, 0, 12); check.DataContext = line; check.Click += CheckBox_Checked; CheckPanel.Children.Add(check); } CheckPanel.Visibility = Visibility.Visible; } else { CheckPanel.Visibility = Visibility.Collapsed; } if (zoomedChartView == null) { return; } if (data.activeZoom > 0) { chartView.SelectDate(data.activeZoom); ZoomChart(true); } else { ZoomOut(false); //chartView.invalidate(); } }; }