本文整理匯總了C#中System.Windows.Forms.DataVisualization.Charting.DataPoint類的典型用法代碼示例。如果您正苦於以下問題:C# DataPoint類的具體用法?C# DataPoint怎麽用?C# DataPoint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DataPoint類屬於System.Windows.Forms.DataVisualization.Charting命名空間,在下文中一共展示了DataPoint類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateNamedPoint
public static DataPoint CreateNamedPoint(string name, double x, double y)
{
DataPoint pnt = new DataPoint(x, y);
pnt.Label = name;
return pnt;
}
示例2: 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);
}
}
示例3: phodiemthi_Load
private void phodiemthi_Load(object sender, EventArgs e)
{
dataGridView1.Hide();
dbVeMTDataContext db = new dbVeMTDataContext();
dataGridView1.Rows.Clear();
var results = from p in db.vemts
group p by p.diem into g
select new { diem = g.Key , soluong = g.Count() };
dataGridView1.DataSource = results;
db.SubmitChanges();
//Tìm và đặt giá trị MAX cho trục Y
int max = Convert.ToInt32(dataGridView1.Rows[0].Cells[0].Value);
for (int i = 1; i <= dataGridView1.SelectedRows.Count; i++)
if (max < Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value))
max = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value);
if (chart1.ChartAreas[0].AxisY.Maximum < max) chart1.ChartAreas[0].AxisY.Maximum = max;
chart1.Series.Clear();
Series s = new Series();
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
s.ChartType = SeriesChartType.Line;
DataPoint p = new DataPoint();
p.XValue = i;
p.SetValueY(Convert.ToDouble(dataGridView1.Rows[i].Cells[1].Value));
//p.AxisLabel = "Điểm " + dataGridView1.Rows[i].Cells[0].Value.ToString() +"";
p.AxisLabel = "điểm" + i.ToString(); ;
s.Points.Add(p);
}
chart1.Series.Add(s);
}
示例4: CreateDataPoint
private static DataPoint CreateDataPoint(double x, string axisLabel, DateTime start, DateTime end, string text, Color color) {
var point = new DataPoint(x, new double[] { start.ToOADate(), end.ToOADate() });
point.Color = color;
point.Label = text;
point.AxisLabel = axisLabel;
return point;
}
示例5: GraphWindow
public GraphWindow(IDictionary<string, decimal> incomes, IDictionary<string, decimal> expenses)
{
InitializeComponent();
labMonth.Visible = false;
btnNext.Visible = false;
btnPrev.Visible = false;
chart.Series.Clear();
Series s = new Series("Money");
chart.Legends.Clear();
s.Color = Color.Green;
foreach (var i in incomes)
{
var dp = new DataPoint(0, (double)i.Value);
dp.Name = i.Key;
dp.AxisLabel = i.Key;
dp.Color = Color.Green;
s.Points.Add(dp);
}
foreach (var i in expenses)
{
var dp = new DataPoint(0, (double)i.Value);
dp.Name = i.Key;
dp.AxisLabel = i.Key;
dp.Color = Color.DarkRed;
s.Points.Add(dp);
}
chart.Series.Add(s);
SetupChartArea();
chart.DataBind();
}
示例6: MitPie
public MitPie(int miID, int akPro)
{
InitializeComponent();
this.MinimumSize = new Size(300, 300);
this.MaximumSize = new Size(800, 500);
chart1.Size = new Size(this.Width - 10, this.Height - 10);
DataTable arbeiter = SqlConnection.SelectStatement("SELECT prName,sum( zeDauer ) as sum,miName,miVorname FROM tzeiterfassung LEFT JOIN tProjekt using (prID) LEFT JOIN tMitarbeiter using (miID) WHERE miID =" + miID + " GROUP BY prID");
DataTableReader reader = arbeiter.CreateDataReader();
Series a = chart1.Series[0];
if (reader.HasRows)
{
while (reader.Read())
{
DataPoint p = new DataPoint();
p.SetValueY(Convert.ToDouble(reader["sum"].ToString()));
p.AxisLabel = reader["prName"].ToString();
p.IsValueShownAsLabel = true;
a.Points.Add(p);
}
Mitarbeiter.Text = reader["miVorname"].ToString() + " " + reader["miName"].ToString();
}
}
示例7: FragmentDataDisplay
public FragmentDataDisplay(XRayDisplays xrayDisplays)
{
InitializeComponent();
CultureResources.registerDataProvider(this);
m_XrayImageDisplay = xrayDisplays;
//============ lisview settings
_TypeCollection.Add("Not Specified");
_TypeCollection.Add("Metal");
_TypeCollection.Add("Organic");
_TypeCollection.Add("Inorganic");
_ShapeCollection.Add("Not Specified");
_ShapeCollection.Add("Cylindical");
_ShapeCollection.Add("Rectangular");
_ShapeCollection.Add("C Shape");
_SizeCollection.Add("Not Specified");
_SizeCollection.Add(" < 4 mm");
_SizeCollection.Add("5mm-8mm");
_SizeCollection.Add("9mm-12mm");
_SizeCollection.Add("13mm-16mm");
_SizeCollection.Add("17mm-20mm");
_SizeCollection.Add(">20mm");
for (int i = 0; i < 99; i++)
{
DataPoint dp = new DataPoint(i + 1, 0);
UniformityChartSeries.Points.Add(dp);
}
}
示例8: MainWindow
public MainWindow()
{
InitializeComponent();
phone_book_root_node = tv_PhoneBook.Nodes["phone_book_root_node"];
sessions_root_node = tv_Sessions.Nodes["sessions_root_node"];
internal_root_node = sessions_root_node.Nodes["internal_root_node"];
external_root_node = sessions_root_node.Nodes["external_root_node"];
inbound_root_node = sessions_root_node.Nodes["inbound_root_node"];
outbound_root_node = sessions_root_node.Nodes["outbound_root_node"];
sessions_root_node.ExpandAll();
talk_duration_less_than_a_minute = new DataPoint { Name = "LessThenAMinute", LegendText = "Talk < 1 min", YValues = new[] { 0.0 }, Color = Color.FromArgb(100, 180, 100) };
c_UserChart.Series[USER_STATES].Points.Add(talk_duration_less_than_a_minute);
talk_duration_over_a_minute = new DataPoint { Name = "OverAMinute", LegendText = "Talk >= 1 min", YValues = new[] { 0.0 }, Color = Color.FromArgb(180, 80, 80) };
c_UserChart.Series[USER_STATES].Points.Add(talk_duration_over_a_minute);
SetState(LoginState.LoggedOut);
presenter = new MainWindowPresenter(this, SimpleIOCContainer.Instance.Resolve<IOPSClient>());
c_Statistics.Series[NUMBER_OF_SESSIONS].Points.AddXY(0, 0);
c_Statistics.Series[NUMBER_OF_DROPPED_SESSIONS].Points.AddXY(0, 0);
presenter.Connect();
t_Timer.Start();
}
示例9: createSampleChart
private void createSampleChart()
{
barChart.ChartAreas.Clear();
barChart.ChartAreas.Add("area1");
ChartArea chartArea = barChart.ChartAreas[0];
chartArea.AxisX.MajorGrid.Enabled = false;
chartArea.AxisY.MajorGrid.Enabled = false;
chartArea.AxisY.Minimum = 0;
chartArea.AxisY.Maximum = 1;
barChart.Series.Clear();
barChart.Series.Add("matches");
Series series = barChart.Series[0];
series.ChartType = SeriesChartType.Column;
series.ChartArea = barChart.ChartAreas[0].Name;
int x = 1;
DataPoint pt = new DataPoint(series);
pt.XValue = x;
x++;
pt.YValues = new double[] { .75 };
pt.AxisLabel = "phrase 1";
series.Points.Add(pt);
pt.BorderColor = System.Drawing.Color.Black;
int r = 255 - (int)(pt.YValues[0] * 255.0);
pt.Color = System.Drawing.Color.FromArgb(r, r, r);
pt = new DataPoint(series);
pt.XValue = x;
x++;
pt.YValues = new double[] { .5 };
pt.AxisLabel = "phrase 2";
series.Points.Add(pt);
pt.BorderColor = System.Drawing.Color.Black;
r = 255 - (int)(pt.YValues[0] * 255.0);
pt.Color = System.Drawing.Color.FromArgb(r, r, r);
}
示例10: changeChartType
public static void changeChartType(this Chart chart,SeriesChartType ChartType)
{
DataPoint[] points = new DataPoint[chart.Series.Count];
if (ChartType == SeriesChartType.Pie)
{
int i = 0;
foreach (var serie in chart.Series)
{
points[i] = serie.Points.FirstOrDefault();
i++;
}
chart.Series.Clear();
var newSerie = chart.Series.Add("Total");
newSerie.ChartType = ChartType;
foreach (var point in points)
{
newSerie.Points.Add(point);
}
return;
}
foreach (var serie in chart.Series)
{
serie.ChartType = ChartType;
}
}
示例11: NewTemp
public void NewTemp(string msg)
{
string[] datum = msg.Split(',');
label1.Text = msg;
if (datum.Length > 5)
{
_lastAmbient = double.Parse(datum[1]);
DataPoint dp = new DataPoint(double.Parse(datum[0]), _lastAmbient);
Chart1.Series["Ambient"].Points.Add(dp);
_lastT1 = double.Parse(datum[2]);
dp = new DataPoint(double.Parse(datum[0]), _lastT1);
Chart1.Series["T0"].Points.Add(dp);
_lastT2 = double.Parse(datum[4]);
dp = new DataPoint(double.Parse(datum[0]), _lastT2);
Chart1.Series["T1"].Points.Add(dp);
if (_showLast50 && Chart1.Series["Ambient"].Points.Count > 50)
{
Chart1.ChartAreas[0].AxisX.ScaleView.Position = Chart1.Series["Ambient"].Points.Count - 50;
Chart1.ChartAreas[0].AxisX.ScaleView.Size = 50;
}
else
{
Chart1.ChartAreas[0].AxisX.ScaleView.ZoomReset();
}
_httpServer.Temps = new double[] { _lastAmbient, _lastT1, _lastT2 };
}
}
示例12: InterpolateAll
public DataPoint[] InterpolateAll(DataPoint[] points, double start, double end)
{
DataPoint[] interpolatedPoints = new DataPoint[Data.ScreenViewSteps];
for(var n = 0; n < Data.ScreenViewSteps; n++) {
var x = start + n*(end - start)/Data.ScreenViewSteps;
var res = points[0].YValues[0];
for(var i = 1; i < points.Length; i++) {
double f = 0;
for(var j = 0; j <= i; j++) {
double den = 1;
for(var k = 0; k <= i; k++) {
if(k != j) {
den *= (points[j].XValue - points[k].XValue);
}
}
f += points[j].YValues[0]/den;
}
for(var k = 0; k < i; k++) {
f *= (x - points[k].XValue);
}
res += f;
}
interpolatedPoints[n] = new DataPoint(x, res);
}
return interpolatedPoints;
}
示例13: MarkUtils
public MarkUtils()
{
InitializeComponent();
foreach (string s in Data.classes)
{
comboBox_classes.Items.Add(s);
Series series = new Series();
series.LegendText = s;
series.ChartType = SeriesChartType.Line;
series.YValueType = ChartValueType.String;
int i = 0;
foreach (Mark m in Data.marks)
{
if (m._class == s)
{
DataPoint dp = new DataPoint();
dp.XValue = i;
dp.YValues = new double[] { m.mark };
dp.Label = m.name;
series.Points.Add(dp);
}
}
chart_marks.Series.Add(series);
}
comboBox_classes.SelectedIndex = 0;
}
示例14: HandleDisplay
/// <summary>
/// Handles the display
/// </summary>
/// <param name="maxDistance"></param>
/// <param name="minDistance"></param>
/// <param name="height"></param>
protected override void HandleDisplay(double maxDistance, double minDistance, double height)
{
PointFunction pointFunction = Function as PointFunction;
if (pointFunction != null)
{
Data.ChartType = SeriesChartType.Point;
if (GraphVisualizer.RecordPreviousValuesInTsm)
{
DisplayPreviousData(maxDistance);
}
if (pointFunction.Point != null && !double.IsNaN(pointFunction.Point.Distance))
{
AddPoint(new DataPoint(pointFunction.Point.Distance, pointFunction.Point.Speed));
}
else if (pointFunction.SimulatedValues.Count != 0)
{
Data.ChartType = SeriesChartType.Line;
DataPoint dataPoint;
foreach (SpeedDistanceProfile profile in pointFunction.SimulatedValues)
{
dataPoint = new DataPoint(0, 0);
dataPoint.IsEmpty = true;
AddPoint(dataPoint);
foreach (SpeedDistancePoint point in profile.Points)
{
dataPoint = new DataPoint(point.Distance, point.Speed);
AddPoint(dataPoint);
}
}
}
}
}
示例15: IsIntersect
/// <summary>
/// Checks to see if two lines intersect
/// Line 1 is defined by series1_Point1 and series1_Point2
/// Line 2 is defined by series2_Point1 and series2_Point2
/// </summary>
/// <param name="series1_Point1">line's start point for series 1</param>
/// <param name="series1_Point2">line's end point for series 1</param>
/// <param name="series2_Point1">line's start point for series 2</param>
/// <param name="series2_Point2">line's end point for series 2</param>
/// <returns>DataPoint of where the lines intersect, null otherwise</returns>
public static DataPoint IsIntersect(DataPoint series1_Point1, DataPoint series1_Point2, DataPoint series2_Point1, DataPoint series2_Point2)
{
//find the slope of series 1's line
double m1 = (series1_Point2.YValues[0] - series1_Point1.YValues[0])
/(series1_Point2.XValue - series1_Point1.XValue);
//find the y intercept of series 1's line
double b1 = series1_Point2.YValues[0] - m1 * series1_Point2.XValue;
//find the slope of series 2's line
double m2 = (series2_Point2.YValues[0] - series2_Point1.YValues[0])
/ (series2_Point2.XValue - series2_Point1.XValue);
//check to make sure the lines aren't parallel
if (m2 == m1)
{
//the lines are parallel so they can not intersect
return null;
}
// find the y intercept of series 2's line
double b2 = series2_Point2.YValues[0] - m2 * series2_Point2.XValue;
//find where the two lines intersect
double xIntersection = (b2 - b1) / (m1 - m2);
//find the max and min X interval of the two line segments
double xmin=0;
double xmax=0;
if (series1_Point1.XValue >= series2_Point1.XValue)
{
xmin = series1_Point1.XValue;
}
else
{
xmin = series2_Point1.XValue;
}
if (series1_Point2.XValue >= series2_Point2.XValue)
{
xmax = series2_Point2.XValue;
}
else
{
xmax = series1_Point2.XValue;
}
//check to see if the xIntersection falls in this range
if (xIntersection >= xmin && xIntersection <= xmax)
{
//figure out the Y value now
double yIntersection = m1 * xIntersection + b1;
return new DataPoint(xIntersection, yIntersection);
}
return null;
}