public void InitializeGraphs() { Research = Statistic.getResearch(); ROSlice = chtResearch.Series[0] as PieSeries; ROSlice.ItemsSource = Research; ROSlice.IsSelectionEnabled = true; ROSlice.SelectionChanged += new SelectionChangedEventHandler(SelectionChanged); Usage = Statistic.getUsage(); USSlice = chtUsage.Series[0] as PieSeries; USSlice.ItemsSource = Usage; USSlice.IsSelectionEnabled = true; USSlice.SelectionChanged += new SelectionChangedEventHandler(SelectionChanged); Combo = Statistic.getCombo(); Bar = new ColumnSeries[3]; for (int x = 0; x < 3; x++) { Bar[x] = chtCombo.Series[x] as ColumnSeries; Bar[x].ItemsSource = Combo[x]; Bar[x].IsSelectionEnabled = true; Bar[x].SelectionChanged += new SelectionChangedEventHandler(Bar_SelectionChanged); } }
/// <summary> /// PaletteProperty property changed handler. /// </summary> /// <param name="d">Parent that changed its Palette.</param> /// <param name="e">Event arguments.</param> private static void OnPalettePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { PieSeries source = d as PieSeries; Collection <ResourceDictionary> newValue = e.NewValue as Collection <ResourceDictionary>; source.OnPalettePropertyChanged(newValue); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.pieChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 2: this.piechart = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; case 3: this.lineChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 4: this.linechart = ((System.Windows.Controls.DataVisualization.Charting.LineSeries)(target)); return; case 5: this.barChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 6: this.columnchart = ((System.Windows.Controls.DataVisualization.Charting.BarSeries)(target)); return; } this._contentLoaded = true; }
/// <summary> /// Initializes a new instance of the PieDataPoint class. /// </summary> public PieDataPoint() { if (DesignerProperties.GetIsInDesignMode(this)) { // Create default design-mode-friendly settings ActualRatio = 0.2; SizeChanged += delegate(object sender, SizeChangedEventArgs e) { // Handle SizeChanged event to update Geometry dynamically PieSeries.UpdatePieDataPointGeometry(this, e.NewSize.Width, e.NewSize.Height); }; } }
/// <summary> /// When a label is clicked, the corresponding PieDataPoint becomes selected. /// This enables master-detail scenario driven by clicking on labels. /// </summary> /// <param name="e"></param> protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { Chart chart = TreeHelper.FindAncestor <Chart>(this); if (chart != null) { PieSeries pieSeries = chart.Series.OfType <PieSeries>().FirstOrDefault(); if (pieSeries != null) { pieSeries.SelectedItem = this.Content; } } }
void VedstedCalibration_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { if (e.NewValue.GetType().Equals(typeof(DemoViewModel))) { this.SourceChart.Series.Clear(); LineSeries Ls = new LineSeries(); Ls.ItemsSource = ((DemoViewModel)DataContext).Discharge.Items; Ls.DependentValuePath = "Value"; Ls.IndependentValuePath = "Time"; Ls.Title = ((DemoViewModel)DataContext).Discharge.Name; SourceChart.Series.Add(Ls); LineSeries Ls2 = new LineSeries(); Ls2.ItemsSource = ((DemoViewModel)DataContext).Outflow.Items; Ls2.DependentValuePath = "Value"; Ls2.IndependentValuePath = "EndTime"; Ls2.Title = ((DemoViewModel)DataContext).Outflow.Name; SourceChart.Series.Add(Ls2); this.concchart.Series.Clear(); LineSeries LS3 = new LineSeries(); LS3.ItemsSource = ((DemoViewModel)DataContext).ChlorideConc.Items; LS3.DependentValuePath = "Value"; LS3.IndependentValuePath = "EndTime"; LS3.Title = ((DemoViewModel)DataContext).ChlorideConc.Name; this.concchart.Series.Add(LS3); LineSeries LS4 = new LineSeries(); LS4.ItemsSource = ((DemoViewModel)DataContext).IsotopeConc.Items; LS4.DependentValuePath = "Value"; LS4.IndependentValuePath = "EndTime"; LS4.Title = ((DemoViewModel)DataContext).IsotopeConc.Name; this.concchart.Series.Add(LS4); WBChart.Series.Clear(); PieSeries PS = new PieSeries(); PS.ItemsSource = ((DemoViewModel)DataContext).WaterBalanceComponents; PS.DependentValuePath = "Value"; PS.IndependentValuePath = "Key"; this.WBChart.Series.Add(PS); concchart.MouseEnter += new MouseEventHandler(concchart_MouseEnter); WBChart.MouseEnter += new MouseEventHandler(WBChart_MouseEnter); SourceChart.MouseEnter += new MouseEventHandler(SourceChart_MouseEnter); } }
/// <summary> /// Called when the value of the ActualOffsetRatioProperty property changes. /// </summary> /// <param name="oldValue">The value to be replaced.</param> /// <param name="newValue">The new value.</param> private void OnActualOffsetRatioPropertyChanged(double oldValue, double newValue) { RoutedPropertyChangedEventHandler <double> handler = this.ActualOffsetRatioChanged; if (handler != null) { handler(this, new RoutedPropertyChangedEventArgs <double>(oldValue, newValue)); } if (DesignerProperties.GetIsInDesignMode(this)) { PieSeries.UpdatePieDataPointGeometry(this, ActualWidth, ActualHeight); } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 9 "..\..\BieuDoNamSanPham.xaml" ((DAnCuoiKy.BieuDoNamSanPham)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.chartYear = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.cmbAcademicYear = ((System.Windows.Controls.ComboBox)(target)); return; case 2: #line 27 "..\..\..\..\Views\ChartReports.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.btnSearch); #line default #line hidden return; case 3: this.mcChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 4: this.Income = ((System.Windows.Controls.DataVisualization.Charting.ColumnSeries)(target)); return; case 5: this.Expense = ((System.Windows.Controls.DataVisualization.Charting.ColumnSeries)(target)); return; case 6: this.expenseChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 7: this.ExpenseData = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; } this._contentLoaded = true; }
void wc_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { try { StreamReader responseReader = new StreamReader(e.Result); string jsonData = responseReader.ReadToEnd(); responseReader.Close(); XmlReader xr = XmlReader.Create(new StringReader(jsonData)); xr.ReadToFollowing("string"); xr.Read(); DataContractJsonSerializer jss = new DataContractJsonSerializer(typeof(ChartClass)); ChartClass cc = (ChartClass)jss.ReadObject(new MemoryStream(System.Text.Encoding.UTF8.GetBytes(xr.Value))); Collection<SectorData> inputData = new Collection<SectorData>(); foreach (SectorData sector in cc.Sectors) { inputData.Add(sector); } PieSeries series = new PieSeries(); series.ItemsSource = inputData; series.IndependentValueBinding = new System.Windows.Data.Binding("Title"); series.DependentValueBinding = new System.Windows.Data.Binding("Value"); series.AnimationSequence = AnimationSequence.LastToFirst; PollPieChart.Series.Add(series); } catch (Exception ex) { throw ex; } finally {} }
void ShowPositionsChart(BrokerageAccountSummary accountSummary) { // Create the pie series associated with positions PieSeries pieSeries = new PieSeries(); pieSeries.ItemsSource = accountSummary.Position; pieSeries.IndependentValueBinding = new Binding("InstrumentSymbol"); pieSeries.DependentValueBinding = new Binding("MarketValue.Amount"); pieSeries.IsSelectionEnabled = true; pieSeries.SelectionChanged += new SelectionChangedEventHandler(PositionSelectionChanged); // Initialies the chart accountsChart.Title = accountSummary.Name; accountsChart.Series.Clear(); accountsChart.Series.Add(pieSeries); _isShowingAccountsChart = false; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.labelToday = ((System.Windows.Controls.Label)(target)); #line 27 "..\..\..\Windows\MainWindow.xaml" this.labelToday.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.labelToday_MouseDown_1); #line default #line hidden return; case 2: this.dataGrid = ((System.Windows.Controls.DataGrid)(target)); #line 30 "..\..\..\Windows\MainWindow.xaml" this.dataGrid.LoadingRowDetails += new System.EventHandler <System.Windows.Controls.DataGridRowDetailsEventArgs>(this.dataGrid_LoadingRowDetails); #line default #line hidden #line 31 "..\..\..\Windows\MainWindow.xaml" this.dataGrid.MouseRightButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.dataGrid_MouseRightButtonDown); #line default #line hidden #line 31 "..\..\..\Windows\MainWindow.xaml" this.dataGrid.MouseRightButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.dataGrid_MouseRightButtonUp); #line default #line hidden #line 32 "..\..\..\Windows\MainWindow.xaml" this.dataGrid.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.dataGrid_PreviewMouseLeftButtonDown); #line default #line hidden return; case 3: this.columnChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 4: this.columnSeries = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); #line 100 "..\..\..\Windows\MainWindow.xaml" this.columnSeries.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.columnSeries_SelectionChanged); #line default #line hidden return; case 5: this.buttonIdle = ((System.Windows.Controls.Button)(target)); #line 223 "..\..\..\Windows\MainWindow.xaml" this.buttonIdle.Click += new System.Windows.RoutedEventHandler(this.buttonGraph_Click); #line default #line hidden return; case 6: this.buttonActive = ((System.Windows.Controls.Button)(target)); #line 224 "..\..\..\Windows\MainWindow.xaml" this.buttonActive.Click += new System.Windows.RoutedEventHandler(this.buttonGraph_Click); #line default #line hidden return; case 7: this.buttonSum = ((System.Windows.Controls.Button)(target)); #line 225 "..\..\..\Windows\MainWindow.xaml" this.buttonSum.Click += new System.Windows.RoutedEventHandler(this.buttonGraph_Click); #line default #line hidden return; case 8: this.label1 = ((System.Windows.Controls.Label)(target)); return; case 9: this.labelY = ((System.Windows.Controls.Label)(target)); #line 227 "..\..\..\Windows\MainWindow.xaml" this.labelY.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.labelY_MouseDown); #line default #line hidden return; case 10: this.comboBoxOneDay = ((System.Windows.Controls.ComboBox)(target)); #line 228 "..\..\..\Windows\MainWindow.xaml" this.comboBoxOneDay.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.comboBoxOneDay_SelectionChanged); #line default #line hidden #line 228 "..\..\..\Windows\MainWindow.xaml" this.comboBoxOneDay.DropDownOpened += new System.EventHandler(this.comboBoxOneDay_DropDownOpened); #line default #line hidden return; case 11: this.labelDay = ((System.Windows.Controls.Label)(target)); return; case 12: this.label = ((System.Windows.Controls.Label)(target)); return; case 13: this.label2 = ((System.Windows.Controls.Label)(target)); return; case 14: this.firstDatePicker = ((System.Windows.Controls.DatePicker)(target)); #line 232 "..\..\..\Windows\MainWindow.xaml" this.firstDatePicker.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.DatePicker_SelectedDateChanged); #line default #line hidden return; case 15: this.secondDatePicker = ((System.Windows.Controls.DatePicker)(target)); #line 233 "..\..\..\Windows\MainWindow.xaml" this.secondDatePicker.SelectedDateChanged += new System.EventHandler <System.Windows.Controls.SelectionChangedEventArgs>(this.DatePicker_SelectedDateChanged); #line default #line hidden return; case 16: this.labelWeek = ((System.Windows.Controls.Label)(target)); #line 234 "..\..\..\Windows\MainWindow.xaml" this.labelWeek.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.labelWeek_MouseDown); #line default #line hidden return; case 17: this.labelMonth = ((System.Windows.Controls.Label)(target)); #line 235 "..\..\..\Windows\MainWindow.xaml" this.labelMonth.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.labelMonth_MouseDown); #line default #line hidden return; case 18: this.graphNext = ((System.Windows.Controls.Button)(target)); #line 236 "..\..\..\Windows\MainWindow.xaml" this.graphNext.Click += new System.Windows.RoutedEventHandler(this.graphNext_Click); #line default #line hidden return; case 19: this.graphPrev = ((System.Windows.Controls.Button)(target)); #line 237 "..\..\..\Windows\MainWindow.xaml" this.graphPrev.Click += new System.Windows.RoutedEventHandler(this.graphPrev_Click); #line default #line hidden return; case 20: this.labelValueList = ((System.Windows.Controls.Label)(target)); return; case 21: this.labelHelp = ((System.Windows.Controls.Label)(target)); return; case 22: this.buttonRefresh = ((System.Windows.Controls.Button)(target)); #line 240 "..\..\..\Windows\MainWindow.xaml" this.buttonRefresh.Click += new System.Windows.RoutedEventHandler(this.buttonRefresh_Click); #line default #line hidden return; case 23: this.buttonWorker = ((System.Windows.Controls.Button)(target)); #line 241 "..\..\..\Windows\MainWindow.xaml" this.buttonWorker.Click += new System.Windows.RoutedEventHandler(this.buttonWorker_Click); #line default #line hidden return; case 24: this.buttonClear = ((System.Windows.Controls.Button)(target)); #line 242 "..\..\..\Windows\MainWindow.xaml" this.buttonClear.Click += new System.Windows.RoutedEventHandler(this.ClearLogs); #line default #line hidden return; case 25: this.buttonChangePassword = ((System.Windows.Controls.Button)(target)); #line 243 "..\..\..\Windows\MainWindow.xaml" this.buttonChangePassword.Click += new System.Windows.RoutedEventHandler(this.buttonChangePassword_Click); #line default #line hidden return; case 26: this.buttonIdleTime = ((System.Windows.Controls.Button)(target)); #line 244 "..\..\..\Windows\MainWindow.xaml" this.buttonIdleTime.Click += new System.Windows.RoutedEventHandler(this.buttonIdleTime_Click); #line default #line hidden return; } this._contentLoaded = true; }
private void service_GetGroupDataCompleted(object sender, GetGroupDataCompletedEventArgs e) { this.Busy.IsBusy = false; if (e.Error != null) { e.Error.ShowError(); return; } if (e.Result != null) { ListChartTab.Tag = e.Result.ToList(); var data = e.Result.ToList(); foreach (var group in data) { //没数据的就不用显示了 var groupItems = group.GroupItems.Where(i => i.Values.Count > 0).ToList(); var scroll = new ScrollViewer() { }; var tab = new TabItem { Header = group.TableName, Tag = group.TableName, }; var grid = new Grid(); var chartWidth = (this.ListChartTab.Width - 50) / 2; var chartHeight = 300; //最大列索引 var maxColumnIndex = Math.Floor(ListChartTab.Width / chartWidth); //最大行索引 var maxRowIndex = ((groupItems.Count % maxColumnIndex == 0 ? 0 : (maxColumnIndex - groupItems.Count % maxColumnIndex)) + groupItems.Count) / maxColumnIndex; //初始化表格布局控件 for (int j = 0; j < maxRowIndex; j++) { RowDefinition rd = new RowDefinition(); rd.Height = new GridLength(chartHeight); grid.RowDefinitions.Add(rd); } for (int j = 0; j < maxColumnIndex; j++) { ColumnDefinition cd = new ColumnDefinition(); cd.Width = new GridLength(chartWidth); grid.ColumnDefinitions.Add(cd); } var rowIndex = 0; var columnIndex = 0; foreach (var groupItem in groupItems) { var chart = new Chart() { Margin = new Thickness(10) }; //把图表放置到相应的单元格中 chart.SetValue(Grid.ColumnProperty, columnIndex); chart.SetValue(Grid.RowProperty, rowIndex); if (columnIndex < maxColumnIndex - 1) { columnIndex++; } else { columnIndex = 0; rowIndex++; } var ps = new PieSeries(); ps.ItemsSource = CombineData(groupItem.Values, 10); ps.IsSelectionEnabled = true; ps.IndependentValuePath = "Key"; ps.DependentValuePath = "Value"; ps.AnimationSequence = AnimationSequence.Simultaneous; ps.SelectionChanged += new SelectionChangedEventHandler(ps_SelectionChanged); chart.Title = groupItem.DisplayName; if (!string.IsNullOrEmpty(groupItem.Description)) chart.Title += string.Format(" ({0})", groupItem.Description); chart.Series.Add(ps); grid.Children.Add(chart); } //滚动控件中包含表格布局 scroll.Content = grid; //tab页中包含滚动控件 tab.Content = scroll; //tab页容器中包含tab页 ListChartTab.Items.Add(tab); if (!string.IsNullOrEmpty(SearchCondition.SelectedTableName) && group.TableName == SearchCondition.SelectedTableName) tab.IsSelected = true; } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.PublisherGrid = ((System.Windows.Controls.Grid)(target)); return; case 2: this.dgPublishers = ((System.Windows.Controls.DataGrid)(target)); return; case 3: this.btnAddPublisher = ((System.Windows.Controls.Button)(target)); return; case 4: this.VolumeGrid = ((System.Windows.Controls.Grid)(target)); return; case 5: this.dgVolume = ((System.Windows.Controls.DataGrid)(target)); return; case 6: this.btnAddVolume = ((System.Windows.Controls.Button)(target)); return; case 7: this.IssueGrid = ((System.Windows.Controls.Grid)(target)); return; case 8: this.dgIssue = ((System.Windows.Controls.DataGrid)(target)); return; case 9: this.btnFindIssues = ((System.Windows.Controls.Button)(target)); return; case 10: this.btnAddIssues = ((System.Windows.Controls.Button)(target)); return; case 11: this.MissingIssueGrid = ((System.Windows.Controls.Grid)(target)); return; case 12: this.dgMissingIssues = ((System.Windows.Controls.DataGrid)(target)); return; case 13: this.txtFindMissingIssues = ((System.Windows.Controls.TextBox)(target)); return; case 14: this.btnBrowseMissingIssues = ((System.Windows.Controls.Button)(target)); return; case 15: this.btnCollectMissingIssues = ((System.Windows.Controls.Button)(target)); return; case 16: this.btnExportMissingIssues = ((System.Windows.Controls.Button)(target)); return; case 17: this.DashboardGrid = ((System.Windows.Controls.Grid)(target)); return; case 18: this.pieChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 19: this.piechart = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; case 20: this.barChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 21: this.columnchart = ((System.Windows.Controls.DataVisualization.Charting.ColumnSeries)(target)); return; case 22: this.MessageGrid = ((System.Windows.Controls.Grid)(target)); return; case 23: this.txtMessages = ((System.Windows.Controls.TextBox)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.InterestWindow = ((EmailAnalyzerUI.InterestWindow)(target)); #line 6 "..\..\InterestWindow.xaml" this.InterestWindow.Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded_1); #line default #line hidden return; case 2: this.ellipse = ((System.Windows.Shapes.Ellipse)(target)); return; case 3: this.Lbl_Loading = ((System.Windows.Controls.Label)(target)); return; case 4: this.WinFabInterestChart = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; } this._contentLoaded = true; }
/// <summary> /// 创建Pie图 /// </summary> public void CreatePieChart() { Chart chart = new Chart(); chart.Title = "员工性别状况图表"; chart.Height = 500; chart.Width = 600; PieSeries pieSeries = new PieSeries(); pieSeries.ItemsSource = listPieEmployeece; pieSeries.IndependentValueBinding = new System.Windows.Data.Binding("Sex"); pieSeries.DependentValueBinding = new System.Windows.Data.Binding("CountEmployeece"); chart.Series.Clear(); chart.Series.Add(pieSeries); PieChart.Children.Clear(); PieChart.Children.Add(chart); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 7 "..\..\DepartmentInterest.xaml" ((EmailAnalyzerUI.DepartmentInterest)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded_1); #line default #line hidden return; case 2: this.DepartmentInterestChart = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; case 3: this.LoadingLabel = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
private void FillChart(Block data, ref Border block) { List<DataChart> worker = new List<DataChart>(); using (SqlCeConnection connStaff = new SqlCeConnection(@"Data Source=C:\GitHub\UnitDashboard\UnitDashboard\App_Data\DataBase\Staff\Staff.sdf")) { DataTable dtX = new DataTable(); DataTable dtY = new DataTable(); string columnX = new Regex("(.+);.+").Match(data.content).Groups[1].Value; string columnY = new Regex(".+;(.+)").Match(data.content).Groups[1].Value; SqlCeCommand selectX = new SqlCeCommand(columnX, connStaff); SqlCeDataAdapter sdaX = new SqlCeDataAdapter(selectX); sdaX.Fill(dtX); SqlCeCommand selectY = new SqlCeCommand(columnY, connStaff); SqlCeDataAdapter sdaY = new SqlCeDataAdapter(selectY); sdaY.Fill(dtY); for (int j = 0; j < dtX.Rows.Count; j++) { string dataX = dtX.Rows[j].ItemArray[0].ToString(); double dataY = Convert.ToDouble(dtY.Rows[j].ItemArray[0].ToString()); worker.Add(new DataChart(dataX, dataY)); } } List<KeyValuePair<string, double>> valueList = new List<KeyValuePair<string, double>>(); foreach (DataChart item in worker) { valueList.Add(new KeyValuePair<string, double>(item.key, item.value)); } Chart chart = new Chart(); chart.Title = "График продаж"; switch(data.type) { case BlockType.ChartLine: LineSeries lineSeries = new LineSeries(); lineSeries.DependentValuePath = "Value"; lineSeries.IndependentValuePath = "Key"; lineSeries.ItemsSource = valueList; chart.Series.Add(lineSeries); break; case BlockType.ChartArea: AreaSeries areaSeries = new AreaSeries(); areaSeries.DependentValuePath = "Value"; areaSeries.IndependentValuePath = "Key"; areaSeries.ItemsSource = valueList; chart.Series.Add(areaSeries); break; case BlockType.ChartBar: BarSeries barSeries = new BarSeries(); barSeries.DependentValuePath = "Value"; barSeries.IndependentValuePath = "Key"; barSeries.ItemsSource = valueList; chart.Series.Add(barSeries); break; case BlockType.ChartColumn: ColumnSeries columnSeries = new ColumnSeries(); columnSeries.DependentValuePath = "Value"; columnSeries.IndependentValuePath = "Key"; columnSeries.ItemsSource = valueList; chart.Series.Add(columnSeries); break; case BlockType.ChartPie: PieSeries pieSeries = new PieSeries(); pieSeries.DependentValuePath = "Value"; pieSeries.IndependentValuePath = "Key"; pieSeries.ItemsSource = valueList; chart.Series.Add(pieSeries); break; } block.Child = chart; }
private void ShowAccountsChart() { // Create the pie series associated with accounts PieSeries pieSeries = new PieSeries(); pieSeries.ItemsSource = ((IAccountsViewModel)this.DataContext).getUserContext().BrokerageAccountSummaries; pieSeries.IndependentValueBinding = new Binding("Name"); pieSeries.DependentValueBinding = new Binding("MarketValue.Amount"); pieSeries.IsSelectionEnabled = true; pieSeries.SelectionChanged += new SelectionChangedEventHandler(AccountSelectionChanged); // Initialies the chart accountsChart.Title = "All Accounts"; accountsChart.Series.Clear(); accountsChart.Series.Add(pieSeries); _isShowingAccountsChart = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Window = ((STL.StatVisual)(target)); return; case 2: this.LayoutRoot = ((System.Windows.Controls.Grid)(target)); return; case 3: this.chtResearch = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 4: this.pieResearch = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; case 5: this.chtUsage = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 6: this.pieUsage = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; case 7: this.chtCombo = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 8: this.colComboJA = ((System.Windows.Controls.DataVisualization.Charting.ColumnSeries)(target)); return; case 9: this.colComboCP = ((System.Windows.Controls.DataVisualization.Charting.ColumnSeries)(target)); return; case 10: this.colComboB = ((System.Windows.Controls.DataVisualization.Charting.ColumnSeries)(target)); return; case 11: this.btnExit = ((System.Windows.Controls.Button)(target)); #line 42 "..\..\StatVisual.xaml" this.btnExit.Click += new System.Windows.RoutedEventHandler(this.btnExit_Click); #line default #line hidden return; case 12: this.lblUse = ((System.Windows.Controls.Label)(target)); return; case 13: this.lblRes = ((System.Windows.Controls.Label)(target)); return; case 14: this.cnvInner = ((System.Windows.Controls.Canvas)(target)); return; case 15: this.lblDep = ((System.Windows.Controls.Label)(target)); return; case 16: this.lblSel = ((System.Windows.Controls.Label)(target)); return; case 17: this.lblInd = ((System.Windows.Controls.Label)(target)); return; case 18: this.lblType = ((System.Windows.Controls.Label)(target)); return; case 19: this.lblCount = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.dgEvents = ((System.Windows.Controls.DataGrid)(target)); return; case 2: this.tbSearchEvent = ((System.Windows.Controls.TextBox)(target)); #line 64 "..\..\..\Window\TableWindow.xaml" this.tbSearchEvent.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.SearchEvent_TextChanged); #line default #line hidden return; case 3: #line 69 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.CancelSearchEvent_Click); #line default #line hidden return; case 4: this.tbNazivEvent = ((System.Windows.Controls.TextBox)(target)); return; case 5: this.tbOznakaEvent = ((System.Windows.Controls.TextBox)(target)); return; case 6: this.tbOpisEvent = ((System.Windows.Controls.TextBox)(target)); return; case 7: this.tbDrzavaEvent = ((System.Windows.Controls.TextBox)(target)); return; case 8: this.tbGradEvent = ((System.Windows.Controls.TextBox)(target)); return; case 9: this.tbMestoEvent = ((System.Windows.Controls.TextBox)(target)); return; case 10: #line 118 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SearchEvent_Click); #line default #line hidden return; case 11: #line 119 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.EditEvent_Click); #line default #line hidden return; case 12: #line 120 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.DeleteEvent_Click); #line default #line hidden return; case 13: this.dgTypes = ((System.Windows.Controls.DataGrid)(target)); return; case 14: this.tbSearchType = ((System.Windows.Controls.TextBox)(target)); #line 160 "..\..\..\Window\TableWindow.xaml" this.tbSearchType.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.SearchType_TextChanged); #line default #line hidden return; case 15: #line 165 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.CancelSearchType_Click); #line default #line hidden return; case 16: this.tbNazivType = ((System.Windows.Controls.TextBox)(target)); return; case 17: this.tbOznakaType = ((System.Windows.Controls.TextBox)(target)); return; case 18: this.tbOpisType = ((System.Windows.Controls.TextBox)(target)); return; case 19: #line 198 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SearchType_Click); #line default #line hidden return; case 20: #line 199 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.EditType_Click); #line default #line hidden return; case 21: #line 200 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.DeleteType_Click); #line default #line hidden return; case 22: this.dgTags = ((System.Windows.Controls.DataGrid)(target)); return; case 23: this.tbSearchTag = ((System.Windows.Controls.TextBox)(target)); #line 239 "..\..\..\Window\TableWindow.xaml" this.tbSearchTag.TextChanged += new System.Windows.Controls.TextChangedEventHandler(this.SearchTag_TextChanged); #line default #line hidden return; case 24: #line 244 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.CancelSearchTag_Click); #line default #line hidden return; case 25: this.dvcTag = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; case 26: this.tbOznakaTag = ((System.Windows.Controls.TextBox)(target)); return; case 27: this.tbOpisTag = ((System.Windows.Controls.TextBox)(target)); return; case 28: #line 274 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.SearchTag_Click); #line default #line hidden return; case 29: #line 275 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.EditTag_Click); #line default #line hidden return; case 30: #line 276 "..\..\..\Window\TableWindow.xaml" ((System.Windows.Controls.Button)(target)).Click += new System.Windows.RoutedEventHandler(this.DeleteTag_Click); #line default #line hidden return; } this._contentLoaded = true; }
/// <summary> /// 创建Pie图 /// </summary> public void CreatePieChart() { Chart chart = new Chart(); //chart.Loaded += new RoutedEventHandler(chart_Loaded); chart.Title = "员工学历状况图表"; chart.Height = 500; chart.Width = 600; PieSeries pieSeries = new PieSeries(); pieSeries.ItemsSource = listPieEmployeece; pieSeries.IndependentValueBinding = new System.Windows.Data.Binding("Education"); pieSeries.DependentValueBinding = new System.Windows.Data.Binding("CountEmployeece"); chart.Series.Clear(); chart.Series.Add(pieSeries); PieChart.Children.Clear(); PieChart.Children.Add(chart); }
private void Bind(DataTable dt) { if (dt == null) return; var _ColumnSeri = new PieSeries(); _ColumnSeri.ItemsSource = dt.AsDataView(); // _ColumnSeri.Title = _BarName; int Number = 0; if (dt.Columns.Count >= 2) { foreach (DataColumn column in dt.Columns) { if (Number == 0) _ColumnSeri.IndependentValuePath = column.ColumnName; else if (Number == 1) { if (column.DataType == typeof(System.String)) { return; } _ColumnSeri.DependentValuePath = column.ColumnName; } Number++; } } _Chart.Title = _TitleName; _Chart.Series.Clear(); _Chart.Series.Add(_ColumnSeri); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 7 "..\..\..\View\MainWindow.xaml" ((ExtentionsSearch.MainWindow)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden return; case 2: this.button = ((System.Windows.Controls.Button)(target)); return; case 3: this.SearchProgress = ((System.Windows.Controls.ProgressBar)(target)); return; case 4: this.SelectedPathName = ((System.Windows.Controls.TextBlock)(target)); return; case 5: this.label = ((System.Windows.Controls.Label)(target)); return; case 6: this.SortByNumberOfFilesRB = ((System.Windows.Controls.RadioButton)(target)); #line 19 "..\..\..\View\MainWindow.xaml" this.SortByNumberOfFilesRB.Checked += new System.Windows.RoutedEventHandler(this.SortByNumberOfFilesRB_Checked); #line default #line hidden return; case 7: this.SortByTotalSizeRB = ((System.Windows.Controls.RadioButton)(target)); #line 20 "..\..\..\View\MainWindow.xaml" this.SortByTotalSizeRB.Checked += new System.Windows.RoutedEventHandler(this.SortByTotalSizeRB_Checked); #line default #line hidden return; case 8: this.tabControl = ((System.Windows.Controls.TabControl)(target)); return; case 9: this.listview = ((System.Windows.Controls.ListView)(target)); return; case 10: this.ExtChart = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 11: this.PieSeries = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; case 12: this.lastcheckLabel = ((System.Windows.Controls.Label)(target)); return; } this._contentLoaded = true; }
// Shows how to add an arbitrary controls to the map // As sample the pie charts series of Wpf toolkit is used // http://wpf.codeplex.com/releases/view/40535 public void AddPieCharts(ShapeLayer layer) { // our demo data var stores = new List<Store>{ new Store { Name = "KA-Center", Latitude = 48.96, Longitude = 8.39, Sales = new List<Sale>{ new Sale{Type = "Food", Amount= 30}, new Sale { Type = "Non Food", Amount = 70 }} }, new Store { Name = "KA-North", Latitude = 49.04, Longitude = 8.41, Sales = new List<Sale>{ new Sale{Type = "Food", Amount = 40}, new Sale { Type = "Non Food", Amount = 50 }, new Sale { Type = "Pet Food", Amount = 10 }} }}; foreach (var store in stores) { // initialize a pie chart for each element Chart chartView = new Chart(); chartView.BeginInit(); chartView.Width = 300; chartView.Height = 250; chartView.Background = new SolidColorBrush(Color.FromArgb(192, 255, 255, 255)); PieSeries pieSeries = new PieSeries(); chartView.Title = store.Name; pieSeries.IndependentValuePath = "Type"; pieSeries.DependentValuePath = "Amount"; pieSeries.ItemsSource = store.Sales; pieSeries.IsSelectionEnabled = true; chartView.Series.Add(pieSeries); chartView.EndInit(); // Add to map ShapeCanvas.SetLocation(chartView, new Point(store.Longitude, store.Latitude)); ShapeCanvas.SetAnchor(chartView, LocationAnchor.Center); ShapeCanvas.SetScaleFactor(chartView, .1); // adopt the element to the scale factor layer.Shapes.Add(chartView); } }
bool ProcessSeriesData(ref List<object> listOfSeries, string chartType, string seriesDataString, ref string failOverMessage) { bool parsed = false; bool isSingleSeries = false; List<ColumnSeries> columnSeriesList = new List<ColumnSeries>(); string[] seriesDataStringArray = seriesDataString.Split(new string[] { Statics.SeparateLineSeries }, StringSplitOptions.RemoveEmptyEntries); if (seriesDataStringArray.Length < 1) { isSingleSeries = true; } foreach (string lineSeriesItemString in seriesDataStringArray) { object series; switch (chartType.ToUpper().Replace(" ","")) { case Statics.Area: series = new AreaSeries(); ((AreaSeries)series).IndependentValuePath = "Key"; ((AreaSeries)series).DependentValuePath = "Value"; break; case Statics.Bar: series = new ColumnSeries(); ((ColumnSeries)series).IndependentValuePath = "Key"; ((ColumnSeries)series).DependentValuePath = "Value"; break; case Statics.Bubble: series = new BubbleSeries(); ((BubbleSeries)series).IndependentValuePath = "Key"; ((BubbleSeries)series).DependentValuePath = "Value"; break; case Statics.RotatedBar: series = new BarSeries(); ((BarSeries)series).IndependentValuePath = "Key"; ((BarSeries)series).DependentValuePath = "Value"; break; case Statics.Histogram: series = new ColumnSeries(); ((ColumnSeries)series).IndependentValuePath = "Key"; ((ColumnSeries)series).DependentValuePath = "Value"; break; case Statics.Line: series = new LineSeries(); ((LineSeries)series).IndependentValuePath = "Key"; ((LineSeries)series).DependentValuePath = "Value"; break; case Statics.Pie: series = new PieSeries(); ((PieSeries)series).IndependentValuePath = "Key"; ((PieSeries)series).DependentValuePath = "Value"; break; case Statics.Scatter: series = new ScatterSeries(); ((ScatterSeries)series).IndependentValuePath = "Key"; ((ScatterSeries)series).DependentValuePath = "Value"; break; case Statics.Stacked: //series = new StackedBarSeries(); //((StackedBarSeries)series).IndependentValuePath = "Key"; //((StackedBarSeries)series).DependentValuePath = "Value"; case Statics.TreeMap: default: failOverMessage = "The specified graph type supplied in the input parameters (initParams) could not be parsed."; return false; } string[] titleSplit = lineSeriesItemString.Split(new string[] { Statics.LineSeriesTitle }, StringSplitOptions.None); if (titleSplit.Length == 3) { switch (chartType.ToUpper().Replace(" ", "")) { case Statics.Area: ((AreaSeries)series).Title = titleSplit[1]; break; case Statics.Bar: ((ColumnSeries)series).Title = titleSplit[1]; break; case Statics.Bubble: ((BubbleSeries)series).Title = titleSplit[1]; break; case Statics.RotatedBar: ((BarSeries)series).Title = titleSplit[1]; break; case Statics.Histogram: ((ColumnSeries)series).Title = titleSplit[1]; break; case Statics.Line: ((LineSeries)series).Title = titleSplit[1]; break; case Statics.Pie: ((PieSeries)series).Title = titleSplit[1]; break; case Statics.Scatter: ((ScatterSeries)series).Title = titleSplit[1]; break; case Statics.Stacked: case Statics.TreeMap: default: break; } } Dictionary<object, object> pointList = new Dictionary<object, object>(); string[] dataSplit = lineSeriesItemString.Split(new string[] { Statics.LineSeriesDataString }, StringSplitOptions.None); object independentValue = string.Empty; object dependentValue = 0.0; if (dataSplit.Length == 3) { string dataString = dataSplit[1]; string[] dataPairStringArray = dataString.Split(new string[] { Statics.SeparateDataPoints }, StringSplitOptions.None); foreach (string pair in dataPairStringArray) { if (pair.Length > 0) { string[] set = pair.Split(new string[] { Statics.SeparateIndDepValues }, StringSplitOptions.None); try { if (set.Length == 2) { Double doubleCandidate; DateTime dateTimeCandidate; // < independent > if (Double.TryParse(set[0], out doubleCandidate)) { independentValue = doubleCandidate; if (_minIndependentValueIsValid) { if ((double)independentValue < (double)_minIndependentValue) { _minIndependentValue = independentValue; } } else { _minIndependentValue = independentValue; _minIndependentValueIsValid = true; } if (_maxIndependentValueIsValid) { if ((double)independentValue > (double)_maxIndependentValue) { _maxIndependentValue = independentValue; } } else { _maxIndependentValue = independentValue; _maxIndependentValueIsValid = true; } } else if (DateTime.TryParse(set[0], out dateTimeCandidate)) { independentValue = dateTimeCandidate; if (_minIndependentValueIsValid) { if ((DateTime)independentValue < (DateTime)_minIndependentValue) { _minIndependentValue = independentValue; } } else { _minIndependentValue = independentValue; _minIndependentValueIsValid = true; } if (_maxIndependentValueIsValid) { if ((DateTime)independentValue > (DateTime)_maxIndependentValue) { _maxIndependentValue = independentValue; } } else { _maxIndependentValue = independentValue; _maxIndependentValueIsValid = true; } } else { independentValue = set[0].ToString(); } // < dependent > if (Double.TryParse(set[1], out doubleCandidate)) { dependentValue = doubleCandidate; } else if (DateTime.TryParse(set[1], out dateTimeCandidate)) { dependentValue = dateTimeCandidate; } else { dependentValue = set[1].ToString(); } pointList.Add(independentValue, dependentValue); } } catch { return false; } } } } else { failOverMessage = string.Format("Parse fail with '{0}'", lineSeriesItemString); return false; } AddItemSourceToSeries(chartType, series, pointList); if (isSingleSeries) { AddAxesToSeries(chartType, series, independentValue); } else { //((ColumnSeries)series).IndependentAxis = new LinearAxis //{ // Title = _independentLabel, // Orientation = AxisOrientation.X, // Minimum = (double)_minIndependentValue, // Maximum = (double)_maxIndependentValue //}; } listOfSeries.Add(series); parsed = true; } return parsed; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 7 "..\..\..\..\MyWindows\Results.xaml" ((Diplom.MyWindows.Results)(target)).Closing += new System.ComponentModel.CancelEventHandler(this.Window_Closing); #line default #line hidden return; case 2: this.numberOfPoints = ((System.Windows.Controls.ComboBox)(target)); return; case 3: this.chartResultEquallyDataResult = ((System.Windows.Controls.Button)(target)); #line 18 "..\..\..\..\MyWindows\Results.xaml" this.chartResultEquallyDataResult.Click += new System.Windows.RoutedEventHandler(this.chartResultEquallyDataResult_Click); #line default #line hidden return; case 4: this.cartResultPlus = ((System.Windows.Controls.Button)(target)); #line 19 "..\..\..\..\MyWindows\Results.xaml" this.cartResultPlus.Click += new System.Windows.RoutedEventHandler(this.cartResultPlus_Click); #line default #line hidden return; case 5: this.dataResultPlus = ((System.Windows.Controls.Button)(target)); #line 20 "..\..\..\..\MyWindows\Results.xaml" this.dataResultPlus.Click += new System.Windows.RoutedEventHandler(this.dataResultPlus_Click); #line default #line hidden return; case 6: this.ShowIsumButton = ((System.Windows.Controls.Button)(target)); #line 21 "..\..\..\..\MyWindows\Results.xaml" this.ShowIsumButton.Click += new System.Windows.RoutedEventHandler(this.ShowIsumButton_Click); #line default #line hidden return; case 7: this.ShowChildsButton = ((System.Windows.Controls.Button)(target)); #line 22 "..\..\..\..\MyWindows\Results.xaml" this.ShowChildsButton.Click += new System.Windows.RoutedEventHandler(this.ShowChildsButton_Click); #line default #line hidden return; case 8: this.ShowCarierButton = ((System.Windows.Controls.Button)(target)); #line 23 "..\..\..\..\MyWindows\Results.xaml" this.ShowCarierButton.Click += new System.Windows.RoutedEventHandler(this.ShowCarierButton_Click); #line default #line hidden return; case 9: this.ShowCinButton = ((System.Windows.Controls.Button)(target)); #line 24 "..\..\..\..\MyWindows\Results.xaml" this.ShowCinButton.Click += new System.Windows.RoutedEventHandler(this.ShowCinButton_Click); #line default #line hidden return; case 10: this.ShowBadParentsButton = ((System.Windows.Controls.Button)(target)); #line 25 "..\..\..\..\MyWindows\Results.xaml" this.ShowBadParentsButton.Click += new System.Windows.RoutedEventHandler(this.ShowBadParentsButton_Click); #line default #line hidden return; case 11: this.LinearGraph = ((System.Windows.Controls.RadioButton)(target)); return; case 12: this.AreaGraph = ((System.Windows.Controls.RadioButton)(target)); return; case 13: this.ColumnGraph = ((System.Windows.Controls.RadioButton)(target)); return; case 14: this.ChartResult = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 15: this.ResultPie = ((System.Windows.Controls.DataVisualization.Charting.PieSeries)(target)); return; case 16: this.DataResult = ((System.Windows.Controls.DataVisualization.Charting.Chart)(target)); return; case 17: this.basePlus = ((System.Windows.Controls.Button)(target)); #line 44 "..\..\..\..\MyWindows\Results.xaml" this.basePlus.Click += new System.Windows.RoutedEventHandler(this.basePlus_Click); #line default #line hidden return; case 18: this.baseEqually = ((System.Windows.Controls.Button)(target)); #line 45 "..\..\..\..\MyWindows\Results.xaml" this.baseEqually.Click += new System.Windows.RoutedEventHandler(this.baseEqually_Click); #line default #line hidden return; case 19: this.baseMinus = ((System.Windows.Controls.Button)(target)); #line 46 "..\..\..\..\MyWindows\Results.xaml" this.baseMinus.Click += new System.Windows.RoutedEventHandler(this.baseMinus_Click); #line default #line hidden return; case 20: this.GridResultBases = ((System.Windows.Controls.DataGrid)(target)); return; case 21: this.abonPlus = ((System.Windows.Controls.Button)(target)); #line 62 "..\..\..\..\MyWindows\Results.xaml" this.abonPlus.Click += new System.Windows.RoutedEventHandler(this.abonPlus_Click); #line default #line hidden return; case 22: this.abonEqually = ((System.Windows.Controls.Button)(target)); #line 63 "..\..\..\..\MyWindows\Results.xaml" this.abonEqually.Click += new System.Windows.RoutedEventHandler(this.abonEqually_Click); #line default #line hidden return; case 23: this.abonMinus = ((System.Windows.Controls.Button)(target)); #line 64 "..\..\..\..\MyWindows\Results.xaml" this.abonMinus.Click += new System.Windows.RoutedEventHandler(this.abonMinus_Click); #line default #line hidden return; case 24: this.GridResultAbons = ((System.Windows.Controls.DataGrid)(target)); return; } this._contentLoaded = true; }