本文整理匯總了C#中System.Windows.Forms.DataVisualization.Charting.DataPoint.SetValueXY方法的典型用法代碼示例。如果您正苦於以下問題:C# DataPoint.SetValueXY方法的具體用法?C# DataPoint.SetValueXY怎麽用?C# DataPoint.SetValueXY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.DataVisualization.Charting.DataPoint
的用法示例。
在下文中一共展示了DataPoint.SetValueXY方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: getData_Click
private void getData_Click(object sender, EventArgs ea)
{
gradesChart.Series.Clear();
output.Write(1);
var grades = new System.Windows.Forms.DataVisualization.Charting.Series
{
Name = "Grade",
Color = System.Drawing.Color.CornflowerBlue,
IsVisibleInLegend = true,
IsXValueIndexed = true,
ChartType = SeriesChartType.Bar,
XValueType = ChartValueType.String,
YValueType = ChartValueType.Double
};
gradesChart.Series.Add(grades);
var numEntries = input.ReadInt32();
for (int i = 0; i < numEntries; i++)
{
var name = input.ReadString();
var grade = input.ReadDouble();
var point = new DataPoint();
point.SetValueXY(name, new object[] { grade + 1.0 });
grades.Points.Add(point);
}
}
示例2: M_Tick
void M_Tick(object sender, EventArgs e)
{
var DocStatus = MongoDBHelper.ExecuteMongoSvrCommand(MongoDBHelper.serverStatus_Command, SystemManager.GetCurrentServer()).Response;
DataPoint queryPoint = new DataPoint();
queryPoint.SetValueXY(DateTime.Now.ToString(), DocStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("query").Value);
MonitorGrap.Series[0].Points.Add(queryPoint);
DataPoint insertPoint = new DataPoint();
insertPoint.SetValueXY(DateTime.Now.ToString(), DocStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("insert").Value);
MonitorGrap.Series[1].Points.Add(insertPoint);
}
示例3: DrawHistogram
public void DrawHistogram(Chart chart)
{
chart.Series["Intensity"].Points.Clear();
for (int i = 0; i < this.intensities.Length; i++)
{
DataPoint dataPoint = new DataPoint();
dataPoint.SetValueXY(i, this.intensities[i]);
chart.Series["Intensity"].Points.Add(dataPoint);
}
}
示例4: M_Tick
private void M_Tick(object sender, EventArgs e)
{
var docStatus =
CommandHelper.ExecuteMongoSvrCommand(CommandHelper.ServerStatusCommand,
RuntimeMongoDbContext.GetCurrentServer()).Response;
var queryPoint = new DataPoint();
queryPoint.SetValueXY(DateTime.Now.ToString(CultureInfo.InvariantCulture),
docStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("query").Value);
MonitorGrap.Series[0].Points.Add(queryPoint);
var insertPoint = new DataPoint();
insertPoint.SetValueXY(DateTime.Now.ToString(CultureInfo.InvariantCulture),
docStatus.GetElement("opcounters").Value.AsBsonDocument.GetElement("insert").Value);
MonitorGrap.Series[1].Points.Add(insertPoint);
}
示例5: CreateHisto
public void CreateHisto(Bitmap image, Chart chart)
{
for(int x = 0; x < image.Width; ++x)
{
for(int y = 0; y < image.Height; ++y)
{
int brightness = image.GetPixel(x, y).R;
++colors[brightness];
}
}
chart.Series["Brightness"].Points.Clear();
for (int x = 0; x < colors.Length; ++x)
{
DataPoint dp = new DataPoint();
dp.SetValueXY(x, colors[x]);
chart.Series["Brightness"].Points.Add(dp);
}
}
示例6: drawUsersChart
void drawUsersChart(List<State> statesList, YearAndMonth Range)
{
mainChart.Series.Clear();
User CurrentUser = null;
foreach (User U in this.statesContainer.Users)
{
if (U.Name == this.listBox1.SelectedItem.ToString())
CurrentUser = U;
}
if (CurrentUser != null)
{
ChartArea area = mainChart.ChartAreas[0];
area.AxisX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Days;
area.AxisX.Interval = 1;
area.AxisX.Title = "Дни";
area.AxisY.Title = "Время, ч.";
area.AxisY.Interval = 0.5;
area.AxisY.Maximum = 12;
Dictionary<Product, Series> data = new Dictionary<Product, Series>();
foreach (DateTime date in this.statesContainer.Dates)
{
if (date.Year == Range.Date.Year && date.Month == Range.Date.Month)
{
Dictionary<Product, double> dailyData = this.statesContainer.UserTimePerDay(CurrentUser, date);
foreach (Product P in dailyData.Keys)
{
if (!data.ContainsKey(P))
{
Series series = new Series(P.Name);
series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
series.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Date;
series.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32;
series.LegendText = P.Name;
data.Add(P, series);
}
DataPoint point = new DataPoint(data[P]);
point.SetValueXY(date, dailyData[P]);
point.Tag = date;
data[P].Points.Add(point);
}
}
}
foreach (KeyValuePair<Product, Series> pair in data)
{
mainChart.Series.Add(pair.Value);
}
}
}
示例7: updateChart
/// <summary>
/// Maj chart suivant le choix
/// </summary>
/// <param name="type"></param>
protected void updateChart(string type)
{
///// CHart
// http://stackoverflow.com/questions/20606838/view-val-label-on-pie-chart-and-not-inside-the-series-when-slice-selected-tru
//this.statChart.Series[0].Points.AddXY("2", "40");
//this.statChart.ChartAreas[0].AxisX.LabelStyle.Format = "C";
this.statChart.AntiAliasing = AntiAliasingStyles.All;
this.statChart.Series[0].Points.Clear();
this.statChart.Series[0].IsVisibleInLegend = true;
this.statChart.Series[0].SmartLabelStyle.Enabled = false;
var pieData = new List<KeyValuePair<string, long>>();
switch (type)
{
case "1":
pieData = this.Db.GetFileXXXByExtension("size");
this.statChart.Series[0].ChartType = SeriesChartType.Pie;
break;
case "2":
pieData = this.Db.GetFileXXXByType("size");
this.statChart.Series[0].ChartType = SeriesChartType.Pie;
break;
case "3":
pieData = this.Db.GetFileXXXByExtension("count");
this.statChart.Series[0].ChartType = SeriesChartType.Pie;
break;
case "4":
pieData = this.Db.GetFileXXXByType("count");
this.statChart.Series[0].ChartType = SeriesChartType.Pie;
break;
case "5":
pieData = this.Db.GetFileXXXByInterval("count");
this.statChart.Series[0].ChartType = SeriesChartType.Column;
this.statChart.Series[0].IsVisibleInLegend = false;
break;
}
// calcul total pour avoir %
double total = 0;
foreach (KeyValuePair<string, long> pair in pieData)
{
total += pair.Value;
}
foreach (KeyValuePair<string, long> pair in pieData)
{
double avg = long.Parse(pair.Value.ToString()) * 100 / total;
// Data arrays.
DataPoint point = new DataPoint();
point.SetValueXY(pair.Key, pair.Value);
point.LegendText = pair.Key.ToString(); // "#VAL";
//point.LabelBackColor = Color.Bisque;
//point.LabelBorderColor = Color.Black;
point.Font = new Font("Calibri Light", 8);
if (avg >= 5)
{
point.Label = pair.Key.ToString() + "\n" + "(" + Math.Round(avg).ToString() + "%)";
point.CustomProperties = "PieLabelStyle = Inside, Exploded = False";
}
else
{
point.CustomProperties = "PieLabelStyle = Disabled, Exploded = True";
}
if (type == "1" || type == "2")
{
point.ToolTip = string.Format("{0}, {1} ({2}%)", pair.Key, pair.Value.ToFileSize(), Math.Round(avg, 2));
}
else if (type == "5")
{
point.LabelAngle = 90;
point.Label = pair.Key.ToString();
point.ToolTip = string.Format("{0}", pair.Value.ToString(), Math.Round(avg, 2));
point.CustomProperties = "PieLabelStyle = Inside, Exploded = True";
point.LabelAngle = -90;
}
else
{
point.ToolTip = string.Format("{0}, {1} ({2}%)", pair.Key.ToString(), pair.Value.ToString(), Math.Round(avg, 2));
}
this.statChart.Series[0].Points.Add(point);
}
}
示例8: SetValue
/// <summary>
/// 將值設定到圖表
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SetValue(object sender, EventArgs e)
{
var docStatus = CommandExecute.ExecuteMongoSvrCommand(DataBaseCommand.ServerStatusCommand,
RuntimeMongoDbContext.GetCurrentServer()).Response;
foreach (var item in CatalogDetailDic.Keys)
{
var queryPoint = new DataPoint();
queryPoint.SetValueXY(DateTime.Now.ToString(CultureInfo.InvariantCulture), SystemStatus.GetValue(docStatus, CatalogDetailDic[item]));
MonitorGrap.Series[item.Split(".".ToCharArray())[1]].Points.Add(queryPoint);
}
}
示例9: Run
public void Run()
{
this.SliderForMarkerSize.trackBar.Value = this.MarkerSize;
this.SliderForMarkerSize.numericUpDown.Value = this.MarkerSize;
this.SliderForLineWidth.trackBar.Value = this.LineWidth;
this.SliderForLineWidth.numericUpDown.Value = this.LineWidth;
this.SliderForOpacity.numericUpDown.Maximum = this.SliderForOpacity.trackBar.Maximum = 255;
this.SliderForOpacity.trackBar.Value = this.Opacity;
this.SliderForOpacity.numericUpDown.Value = this.Opacity;
if ((InputSimpleData==null)||((X_AxisValues != null) && (X_AxisValues.Count != InputSimpleData[0].Count))) return;
if ((X_AxisValues != null) && (X_AxisValues.Min() <= 0) && (IsLogAxis)) return;
#region multiple readouts
if (ListCurves.Count > 0)
{
//for (int IdxSimpleReadoutCurve = 0; IdxSimpleReadoutCurve < input.Count; IdxSimpleReadoutCurve++)
foreach (cCurveForGraph item in ListCurves)
{
if (item == null) continue;
Series NewSerie = new System.Windows.Forms.DataVisualization.Charting.Series(item.Title);
//NewSerie.ChartType = SeriesChartType.ErrorBar;
NewSerie.ChartType = SeriesChartType.Point;
// NewSerie.ChartType = SeriesChartType.Point;
//NewSerie.ChartType = SeriesChartType.SplineRange;
NewSerie.ShadowOffset = 0;
//NewSerie.ShadowColor = Color.Transparent;
#region loop over the multireadouts curves
for (int j = 0; j < item.ListPtValues.Count; j++)
{
//this.chartForPoints.Series[0].Points[j].MarkerColor = Color.FromArgb(128, GlobalInfo.ListCellularPhenotypes[(int)MachineLearning.Classes[j]].ColourForDisplay);
cExtendedList ListValues = new cExtendedList();
for (int IdxValue = 1; IdxValue < item.ListPtValues[j].Count; IdxValue++)
{
ListValues.Add(item.ListPtValues[j][IdxValue]);
}
double[] Values = new double[2];
double Mean = ListValues.Mean();
double Std = ListValues.Std();
if (NewSerie.ChartType == SeriesChartType.ErrorBar)
{
Values = new double[3];
Values[0] = Mean;
Values[1] = Mean - Std;
Values[2] = Mean + Std;
DataPoint DP = new DataPoint();
DP.XValue = item.ListPtValues[j][0];
DP.YValues = Values;
DP.Color = Color.AliceBlue;
NewSerie.Points.Add(DP);
}
else if (NewSerie.ChartType == SeriesChartType.SplineRange)
{
Values[0] = Mean - Std;
Values[1] = Mean + Std;
DataPoint DP = new DataPoint();
DP.XValue = item.ListPtValues[j][0];
DP.YValues = Values;
DP.Color = Color.FromArgb(200, Color.Tomato);
// DP.MarkerSize = 10;
NewSerie.Points.Add(DP);
}
else
{
// Values = ListValues.ToArray();
for (int i = 0; i < ListValues.Count; i++)
{
DataPoint DP = new DataPoint();
DP.SetValueXY(item.ListPtValues[j][0], ListValues[i]);
DP.Color = Color.FromArgb(190, Color.Tomato);
DP.BorderColor = Color.Black;
DP.BorderWidth = 1;
DP.MarkerSize = 8;
DP.MarkerStyle = MarkerStyle.Circle;
NewSerie.Points.Add(DP);
}
}
// DP.Tag = DataSerie.Tag;
//// Value[0] = item.ListPtValues[j];
//for (int IdxValue = 1; IdxValue < item.ListPtValues[j].Count; IdxValue++)
//{
// ListValues.Add(item.ListPtValues[j][IdxValue]);
//}
//double[] Values = new double[2];
////Values[0] = ListValues.Mean();
//.........這裏部分代碼省略.........
示例10: GetPieChart
private Chart GetPieChart()
{
Chart chart = new Chart();
ChartArea area = new ChartArea();
Series series = new Series();
DataPoint point;
List<DeviceStats>[] levels = GetLevels(ReportDays);
Color[] colors = GetLevelColors();
int totalDeviceCount;
area.Area3DStyle.Enable3D = true;
series.ChartType = SeriesChartType.Pie;
totalDeviceCount = levels.Sum(level => level.Count);
for (int i = 0; i < levels.Length; i++)
{
if (levels[i].Count > 0)
{
point = new DataPoint();
point.SetValueXY(string.Format("L{0} ({1:N0}%)", i, 100.0D * levels[i].Count / totalDeviceCount), levels[i].Count);
point.Color = colors[i];
point.Font = new Font(FontFamily.GenericSansSerif, 40.0F);
series.Points.Add(point);
}
}
chart.Width = 1200;
chart.Height = 1200;
chart.ChartAreas.Add(area);
chart.Series.Add(series);
return chart;
}
示例11: DrawIncome
private void DrawIncome()
{
dateTimePicker1.Enabled = true;
dateTimePicker2.Enabled = true;
chart1.Series.Clear();
chart1.Legends.Clear();
chart1.Titles.Clear();
var s = new Series();
s.ChartType = SeriesChartType.Line;
DataTable dt = new DataTable();
postgreConnection.SelectFrom("orders.price, orders.work_end_date", String.Format("orders where squad={0} and work_start_date>='{1}' and work_end_date<='{2}'",
((int)listBox1.SelectedValue).ToString(), dateTimePicker1.Value.ToString("yyyy-MM-dd"), dateTimePicker2.Value.ToString("yyyy-MM-dd")),
dt);
DataPoint dp;
foreach (DataRow dr in dt.Rows)
{
dp = new DataPoint();
dp.SetValueXY(DateTime.Parse(dr.ItemArray[1].ToString()), (double)(dr[0]));
dp.Label = DateTime.Parse(dr.ItemArray[1].ToString()).ToShortDateString();
dp.Color = Color.Coral;
dp.MarkerSize = 5;
dp.MarkerColor = Color.Coral;
dp.MarkerStyle = MarkerStyle.Circle;
s.Points.Add(dp);
}
if (dt.Rows.Count == 0)
chart1.Titles.Add("Нет данных для отображения.");
chart1.Series.Clear();
chart1.Series.Add(s);
chart1.Series[0].XValueType = ChartValueType.DateTime;
chart1.ChartAreas[0].AxisX.LabelStyle.Format = "yyyy";
chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = true;
chart1.ChartAreas[0].AxisX.Interval = 1;
chart1.ChartAreas[0].AxisX.IntervalType = DateTimeIntervalType.Years;
chart1.ChartAreas[0].AxisX.IntervalOffset = 1;
chart1.ChartAreas[0].RecalculateAxesScale();
chart1.Series[0].XValueType = ChartValueType.DateTime;
DateTime minDate = new DateTime(1990, 01, 01).AddSeconds(-1);
DateTime maxDate = DateTime.Now; // or DateTime.Now;
chart1.ChartAreas[0].AxisX.Minimum = dateTimePicker1.Value.ToOADate();
chart1.ChartAreas[0].AxisX.Maximum = dateTimePicker2.Value.ToOADate();
chart1.ChartAreas[0].CursorX.IsUserEnabled = true;
chart1.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
chart1.ChartAreas[0].AxisY.ScaleView.Zoomable = true;
chart1.ChartAreas[0].CursorY.IsUserEnabled = true;
chart1.ChartAreas[0].CursorY.IsUserSelectionEnabled = true;
chart1.ChartAreas[0].AxisY.LabelStyle.Format = "{#,##} рублей";
chart1.ChartAreas[0].AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8, System.Drawing.FontStyle.Regular);
}
示例12: SetData
private void SetData(double num)
{
DataPoint temp = new DataPoint();
if (chart1.InvokeRequired)
{
SetDataCallback d = SetData;
chart1.Invoke(d, num);
}
else
{
try
{
temp.SetValueXY(i, num);
i++;
chart1.Series[0].Points.Add(temp);
}
catch
{
}
}
}
示例13: DrawData
public void DrawData(int oper, double number, DbConnect pgc, string from,string formName =null)
{
if (formName != null)
{
this.Text = formName;
button3.Enabled = true;
}
bool compRes = false;
chart1.Series.Clear();
Series sIncome = new Series(), sExpenses = new Series();
sIncome.ChartType = sExpenses.ChartType = SeriesChartType.Line;
DataTable dt = new DataTable();
DataPoint dp = new DataPoint();
DataTable ordersTable = new DataTable();
pgc.SelectFrom("*", from, ordersTable);
sIncome.LegendText = "Доход";
sIncome.Color = Color.Blue;
sExpenses.Color = Color.Red;
sExpenses.LegendText = "Расход";
foreach (DataRow dr in ordersTable.Rows)
{
dp = new DataPoint();
dp.Color = Color.Blue;
dp.MarkerSize = 5;
dp.MarkerColor = Color.Blue;
dp.MarkerStyle = MarkerStyle.Circle;
dp.IsEmpty = false;
pgc.SelectFromFunc("*", "order_expenses_income", dr.ItemArray[0].ToString(), dt);
if (oper != -1 && number > 0)
if (Compare(oper, number, dt.Rows[0].ItemArray[0]) && Compare(oper, number, dt.Rows[0].ItemArray[1]))
compRes = true;
else
compRes = false;
if ((compRes) || (oper == -1 && number ==-1))
{
try
{
dp.SetValueXY(DateTime.Parse(dr.ItemArray[6].ToString()), dt.Rows[0].ItemArray[0]);
dp.Label = DateTime.Parse(dr.ItemArray[6].ToString()).ToShortDateString() + " " + dr.ItemArray[9].ToString();
sIncome.Points.Add(dp);
}
catch
{
}
dp = new DataPoint();
dp.Color = Color.Red;
dp.MarkerSize = 5;
dp.MarkerColor = Color.Red;
dp.MarkerStyle = MarkerStyle.Circle;
dp.IsEmpty = false;
dp.SetValueXY(DateTime.Parse(dr.ItemArray[6].ToString()), dt.Rows[0].ItemArray[1]);
dp.Label = DateTime.Parse(dr.ItemArray[6].ToString()).ToShortDateString() + " " + dr.ItemArray[9].ToString();
sExpenses.Points.Add(dp);
}
dt.Clear();
}
sExpenses.XValueType = ChartValueType.Date;
sIncome.XValueType = ChartValueType.Date;
//chart1.ChartAreas[0].AxisX.ScaleView.Zoom(0, 10);
chart1.Series.Add(sExpenses);
chart1.Series.Add(sIncome);
chart1.ChartAreas[0].RecalculateAxesScale();
}
示例14: updateMonthsSavings
private void updateMonthsSavings()
{
Series savingsSeries = new Series();
savingsSeries.Color = Color.LimeGreen;
savingsSeries.LegendText = "יתרה";
savingsChart.Series.Add(savingsSeries);
foreach (ColumnHeader col in monthsCompListView.Columns)
{
if (col.Tag != null)
{
double incomesTotal = 0;
double expensesTotal = 0;
foreach (ListViewGroup group in monthsCompListView.Groups)
{
double total = 0;
foreach (ListViewItem item in group.Items)
total += Double.Parse(item.SubItems[col.Index].Text);
if (group.Header.ToString().StartsWith(Database.INCOME_STRING))
incomesTotal += total;
else
expensesTotal += total;
}
double savings = incomesTotal - expensesTotal;
DataPoint pSavings = new DataPoint();
if (savings < 0)
pSavings.Color = Color.Red;
pSavings.SetValueXY(((DateTime)col.Tag).ToShortDateString(), savings);
pSavings.ToolTip = "יתרה" + ":" + savings.ToString("N", new CultureInfo("en-US")) + " " + Database.NIS_SIGN;
savingsSeries.Points.Add(pSavings);
}
}
}
示例15: drawProductsChart
void drawProductsChart(List<State> statesList)
{
mainChart.Series.Clear();
foreach(string name in this.listBox1.SelectedItems)
{
ChartArea area = mainChart.ChartAreas[0];
area.AxisY.Title = "Количество лицензий";
area.AxisY.Interval = 1;
area.AxisY.Maximum = this.statesContainer.MaxUsersCount + 1;
area.AxisX.IntervalType = System.Windows.Forms.DataVisualization.Charting.DateTimeIntervalType.Minutes;
area.AxisX.IntervalAutoMode = IntervalAutoMode.FixedCount;
area.AxisX.Title = "Время";
area.AxisX.Interval = 30;
Series series = new Series(name);
series.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
series.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
series.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Int32;
series.BorderWidth = 5;
series.LegendText = name;
foreach (State s in statesList)
{
Product p = s.FindProductByName(name);
double y = p == null ? 0 : p.currUsersNum;
DataPoint point = new DataPoint(series);
point.SetValueXY(s.Datetime, y);
point.Tag = p;
series.Points.Add(point);
}
mainChart.Series.Add(series);
}
}