protected void UpdateMaterialChart() { if (_ctMaterial.InvokeRequired) { _ctMaterial.Invoke((System.Windows.Forms.MethodInvoker) (() => _ctMaterial.DataBind())); } else { _ctMaterial.DataBind(); } }
private void PopulateChartData(System.Windows.Forms.DataVisualization.Charting.Chart performanceChart, PerformanceData.DataType dataType) { PerformanceData.FetchPerformanceData(dataType); foreach (string address in PerformanceData.Addresses) { System.Windows.Forms.DataVisualization.Charting.Series series = new System.Windows.Forms.DataVisualization.Charting.Series(); series.ChartArea = "ChartArea1"; series.IsValueShownAsLabel = true; series.Legend = "Legend1"; series.Name = address; series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; performanceChart.Series.Add(series); } for (int index = 0; index < PerformanceData.DataRanges.Length; index++) { int iXPoint = PerformanceData.DataRanges[index]; PerformanceData.TimeTakenForData[] tymTaken = null; PerformanceData.GraphData.TryGetValue(iXPoint, out tymTaken); foreach (PerformanceData.TimeTakenForData tmtaken in tymTaken) { performanceChart.Series[tmtaken.Address].Points.AddXY(iXPoint, tmtaken.TimeTaken); } } performanceChart.DataBind(); }
/// <summary> /// 画图程序 /// </summary> /// <param name="dt"></param> /// <param name="chart"></param> private void PicPaint(ref DataTable rawData, ref System.Windows.Forms.DataVisualization.Charting.Chart chart) { //将数据传给换图组件Chart for (int row = 0; row < rawData.Rows.Count; row++) { chart.Series[0].Points.AddXY(rawData.Rows[row][0], Convert.ToDouble(rawData.Rows[row][1])); } chart.DataBind(); }
private void setupOrientationGraph(System.Windows.Forms.DataVisualization.Charting.Chart chart) { chart.Titles["TitleChartOrientation"].Text = "Orientation"; chart.Series.Add("orientation"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart.Series.Last().YValueMembers = dataTableRowOrientationName; chart.Series.Last().Color = Color.Red; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.ChartAreas.FirstOrDefault().AxisX.LabelStyle.Format = "HH:mm:ss"; chart.ChartAreas.FirstOrDefault().AxisY.Interval = 1; setupCommonGraph(chart); chart.DataSource = sensorDataTable; chart.DataBind(); }
private void setupSoundLevelGraph(System.Windows.Forms.DataVisualization.Charting.Chart chart) { chart.Titles["TitleChartSoundLevel"].Text = "SoundLevel"; chart.Series.Add("soundLevel"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowSoundLevelName; chart.Series.Last().BorderWidth = 1; chart.Series.Last().BorderColor = Color.DarkOrange; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.ChartAreas.FirstOrDefault().AxisX.LabelStyle.Format = "HH:mm:ss"; setupCommonGraph(chart); chart.DataSource = sensorDataTable; chart.DataBind(); }
private void setupRssiGraph(System.Windows.Forms.DataVisualization.Charting.Chart chart) { chart.Titles["TitleChartRssi"].Text = "RSSI"; chart.Series.Add("rssi"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowRssidBmName; chart.Series.Last().BorderWidth = 1; chart.Series.Last().Color = Color.Red; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.ChartAreas.FirstOrDefault().AxisX.LabelStyle.Format = "HH:mm:ss"; chart.ChartAreas.FirstOrDefault().AxisY.Title = "dBm"; setupCommonGraph(chart); chart.DataSource = sensorDataTable; chart.DataBind(); }
private void setupInteractionGraph(System.Windows.Forms.DataVisualization.Charting.Chart chart) { chart.Titles["TitleChartInteraction"].Text = "Interaction"; chart.Series.Add("hugs"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowHugsName; chart.Series.Last().Color = Color.DarkGreen; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.ChartAreas.Last().AxisY.Interval = 1; chart.Series.Add("slaps"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowSlapsName; chart.Series.Last().Color = Color.DarkRed; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.ChartAreas.Last().AxisY.Interval = 1; chart.Series.Add("drops"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowDropsName; chart.Series.Last().Color = Color.MediumPurple; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.ChartAreas.Last().AxisY.Interval = 1; chart.Series.Add("nudges"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowNudgesName; chart.Series.Last().Color = Color.Red; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.ChartAreas.FirstOrDefault().AxisX.LabelStyle.Format = "HH:mm:ss"; chart.ChartAreas.Last().AxisY.Interval = 1; setupCommonGraph(chart); chart.DataSource = sensorDataTable; chart.DataBind(); }
private void setupPowerGraph(System.Windows.Forms.DataVisualization.Charting.Chart chart) { chart.Titles["TitleChartPower"].Text = "Power"; chart.Series.Add("energy (mWh)"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.DateTime; chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowEnergymWPerHourName; chart.Series.Last().BorderWidth = 1; chart.Series.Last().BorderColor = Color.DarkBlue; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.Series.Last().YAxisType = System.Windows.Forms.DataVisualization.Charting.AxisType.Secondary; chart.Series.Add("battery (mV)"); chart.Series.Last().XValueMember = dataTableRowTimeName; chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowBatterymVName; chart.Series.Last().BorderWidth = 1; chart.Series.Last().BorderColor = Color.DarkGreen; chart.Series.Last().YAxisType = System.Windows.Forms.DataVisualization.Charting.AxisType.Primary; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.ChartAreas.FirstOrDefault().AxisX.LabelStyle.Format = "HH:mm:ss"; chart.ChartAreas.FirstOrDefault().AxisY.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.True; chart.ChartAreas.FirstOrDefault().AxisY.Title = "mV"; chart.ChartAreas.FirstOrDefault().AxisY.LineColor = Color.DarkBlue; chart.ChartAreas.FirstOrDefault().AxisY.MajorTickMark.LineColor = Color.DarkBlue; chart.ChartAreas.FirstOrDefault().AxisY.TitleForeColor = Color.DarkBlue; chart.ChartAreas.FirstOrDefault().AxisY.LabelStyle.ForeColor = Color.DarkBlue; chart.ChartAreas.FirstOrDefault().AxisY2.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.True; chart.ChartAreas.FirstOrDefault().AxisY2.Title = "mWh"; chart.ChartAreas.FirstOrDefault().AxisY2.LineColor = Color.DarkGreen; chart.ChartAreas.FirstOrDefault().AxisY2.MajorTickMark.LineColor = Color.DarkGreen; chart.ChartAreas.FirstOrDefault().AxisY2.TitleForeColor = Color.DarkGreen; chart.ChartAreas.FirstOrDefault().AxisY2.LabelStyle.ForeColor = Color.DarkGreen; setupCommonGraph(chart); chart.DataSource = sensorDataTable; chart.DataBind(); }
private void setupTrafficGraph(System.Windows.Forms.DataVisualization.Charting.Chart chart) { chart.Titles["TitleChartTraffic"].Text = "Traffic Totals Since Reset"; chart.Series.Add("uplink bytes"); chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowUplinkBytesName; chart.Series.Last().YAxisType = System.Windows.Forms.DataVisualization.Charting.AxisType.Primary; chart.Series.Last().Color = Color.Red; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.Series.Add("uplink datagrams"); chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowUplinkDatagramsName; chart.Series.Last().Color = Color.DarkRed; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.Series.Last().YAxisType = System.Windows.Forms.DataVisualization.Charting.AxisType.Secondary; chart.Series.Add("downlink bytes"); chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowDownlinkBytesName; chart.Series.Last().Color = Color.LightBlue; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.Series.Last().YAxisType = System.Windows.Forms.DataVisualization.Charting.AxisType.Primary; chart.Series.Add("downlink datagrams"); chart.Series.Last().ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line; chart.Series.Last().YValueMembers = dataTableRowDownlinkDatagramsName; chart.Series.Last().Color = Color.DarkBlue; chart.Series.Last().MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Cross; chart.Series.Last().YAxisType = System.Windows.Forms.DataVisualization.Charting.AxisType.Secondary; chart.ChartAreas.FirstOrDefault().AxisX.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.False; chart.ChartAreas.FirstOrDefault().AxisY.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.True; chart.ChartAreas.FirstOrDefault().AxisY.Title = "bytes"; chart.ChartAreas.FirstOrDefault().AxisY2.Enabled = System.Windows.Forms.DataVisualization.Charting.AxisEnabled.True; chart.ChartAreas.FirstOrDefault().AxisY2.Title = "datagrams"; setupCommonGraph(chart); chart.DataSource = trafficDataTable; chart.DataBind(); }
private void _updateRefreshChart(System.Windows.Forms.DataVisualization.Charting.Chart chart) { chart.DataBind(); }