本文整理汇总了C#中System.Windows.Forms.DataVisualization.Charting.Series类的典型用法代码示例。如果您正苦于以下问题:C# Series类的具体用法?C# Series怎么用?C# Series使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Series类属于System.Windows.Forms.DataVisualization.Charting命名空间,在下文中一共展示了Series类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Graph
/// <summary>
/// Constructor
/// </summary>
/// <param name="graphVisualizer"></param>
public Graph(GraphVisualizer graphVisualizer)
{
GraphVisualizer = graphVisualizer;
Data = new Series();
GraphVisualizer.Series.Add(Data);
}
示例2: AddChartToForm
private Chart AddChartToForm(ChartData chartData)
{
var chart = new Chart { Dock = DockStyle.Fill, BackColor = Color.White };
var title = new Title(chartData.ToString()) { Font = new Font("Verdana", 14.0f) };
chart.Titles.Add(title);
chart.Legends.Add(new Legend("Legend"));
var area = new ChartArea("Main")
{
BackColor = Color.White,
BackSecondaryColor = Color.LightSteelBlue,
BackGradientStyle = GradientStyle.DiagonalRight,
AxisY = { Maximum = 100 },
AxisY2 = { Maximum = 20 }
};
area.AxisX.MajorGrid.LineColor = Color.LightSlateGray;
area.AxisX.TitleFont = new Font("Verdana", 10.0f, FontStyle.Bold);
area.AxisX.Title = "Date";
area.AxisY.MajorGrid.LineColor = Color.LightSlateGray;
area.AxisY.TitleFont = new Font("Verdana", 10.0f, FontStyle.Bold);
area.AxisY.Title = "Weight";
area.AxisY2.Title = "Reps";
chart.ChartAreas.Add(area);
var seriesColumns1 = new Series("Weights") { ChartType = SeriesChartType.Line, IsValueShownAsLabel = true };
chart.Series.Add(seriesColumns1);
var seriesColumns2 = new Series("Reps") { ChartType = SeriesChartType.Line };
chart.Series.Add(seriesColumns2);
Controls.Add(chart);
return chart;
}
示例3: Make
public void Make(List<int> values, List<string> answerNames, string question)
{
//clear the chart
chart1.Series.Clear();
Dictionary<string, int> Columns = new Dictionary<string, int>();
List<Color> Colors = new List<Color>() {
Color.Black, Color.Blue, Color.Red, Color.Green, Color.Pink
};
//initialize new instances for a diagram
Series series = new Series();
series.ChartArea = "ChartArea1";
chart1.ChartAreas["ChartArea1"].RecalculateAxesScale();
series.IsVisibleInLegend = false;
//add columns to the diagram
for (int i = 0; i < answerNames.Count; i++)
{
series.Points.AddXY(answerNames[i], values[i]);
//give color to each individual column
series.Points[i].Color = (i < 5) ? Colors[i] : Colors[(int)Math.Floor(((double)i / 5))];
}
chart1.Series.Add(series);
//add question above the diagram
labelQuestion.Text = question;
}
示例4: btnFindOptimalLocation_Click
private void btnFindOptimalLocation_Click(object sender, EventArgs e)
{
this.Cursor = Cursors.WaitCursor;
DiscretizationStep = Convert.ToDouble(tbDiscretizationStep.Text);
SourceMovingStep = Convert.ToDouble(tbSourceMovingStep.Text);
StepDecreasingMultiplier = Convert.ToDouble(tbStepDecreasingMultiplier.Text);
StepMinimum = Convert.ToDouble(tbStepMinimum.Text);
EpsKlepper = Convert.ToDouble(tbEps.Text);
var optimalLocation = KlepperAlgorithm.FindOptimalAllocation(
DiscreteSet,
InitialSourceSet,
DiscretizationStep,
SourceMovingStep,
StepDecreasingMultiplier,
StepMinimum,
EpsKlepper
);
var y = new Series();
y.Color = Color.OrangeRed;
y.ChartType = SeriesChartType.Point;
y.MarkerStyle = MarkerStyle.Circle;
y.Name = "Оптимальное размещение по алгоритму Клеппера";
foreach (var point in optimalLocation)
y.Points.AddXY(point.X, point.Y);
chAlgorithms.Series.Add(y);
tbMu.Text = KlepperAlgorithm.Mu.ToString();
this.Cursor = Cursors.Default;
}
示例5: FillColumnChart
public void FillColumnChart(DataTable DT)
{
dataGridView1.DataSource = DT;
chart2.Series.Clear();
Series seriesAll = new Series("总收入");
chart2.Series.Add(seriesAll);
Series seriesLixi = new Series("利息");
chart2.Series.Add(seriesLixi);
chart2.DataSource = DT;
//设置图表Y轴对应项
seriesAll.YValueMembers = "All";
seriesLixi.YValueMembers = "Lixi";
//设置图表X轴对应项
chart2.Series[0].XValueMember = "Time";
//chart2.ChartAreas[0].Area3DStyle.Enable3D = true;
//chart2.ChartAreas[0].Area3DStyle.Inclination = 30;
//chart2.ChartAreas[0].Area3DStyle.PointDepth = 50;
//chart2.ChartAreas[0].Area3DStyle.IsClustered = true;
//chart2.ChartAreas[0].AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
chart2.DataBind();
}
示例6: CreateSeries
protected virtual void CreateSeries() {
Series bestKnown = new Series("Alleles of Best Known Solution");
bestKnown.ChartType = SeriesChartType.Column;
bestKnown.XValueType = ChartValueType.String;
bestKnown.YValueType = ChartValueType.Double;
bestKnown.YAxisType = AxisType.Primary;
chart.Series.Add(bestKnown);
Series others = new Series("Other Alleles");
others.ChartType = SeriesChartType.Column;
others.XValueType = ChartValueType.String;
others.YValueType = ChartValueType.Double;
others.YAxisType = AxisType.Primary;
chart.Series.Add(others);
invisibleSeries.Add(others);
Series qualities = new Series("Average Solution Qualities");
qualities.ChartType = SeriesChartType.FastPoint;
qualities.XValueType = ChartValueType.String;
qualities.YValueType = ChartValueType.Double;
qualities.YAxisType = AxisType.Secondary;
chart.Series.Add(qualities);
Series impacts = new Series("Average Impact");
impacts.ChartType = SeriesChartType.FastPoint;
impacts.XValueType = ChartValueType.String;
impacts.YValueType = ChartValueType.Double;
impacts.YAxisType = AxisType.Secondary;
chart.Series.Add(impacts);
}
示例7: Init
public void Init(StatisticsCollection collection, Core core)
{
mCore = core;
mCollection = collection;
foreach (var name in collection.StatisticsNames) {
Series current = new Series(name, 100);
Series mean = new Series(name + " Mean", 100);
current.ChartType = SeriesChartType.Line;
mean.ChartType = SeriesChartType.Line;
sharedGraph.Series.Add(current);
sharedGraph.Series.Add(mean);
namesList.Items.Add(name);
ListViewItem row = new ListViewItem(name);
//row.SubItems.Add(name);
row.SubItems.Add("0");
row.SubItems.Add("0");
row.SubItems.Add("0");
row.SubItems.Add("0");
statsList.Items.Add(row);
mCurrentSeries.Add(name, current);
mMeanSeries.Add(name, mean);
mRows.Add(name, row);
}
}
示例8: chartForecastTestNumberbyduration_Load
private void chartForecastTestNumberbyduration_Load(object sender, EventArgs e)
{
GetSummary();
GetForecastSummaryData(_dataSet);
lqtChart2.Series.Clear();
IList<string> UniqueTestingAreas=new List<string>();
foreach (ForecastSummaryData fsd in _fSummaryData)
{
if(!UniqueTestingAreas.Contains(fsd.TestingArea))
UniqueTestingAreas.Add(fsd.TestingArea);
}
foreach (string ta in UniqueTestingAreas)
{
Series series = new Series(ta);
series.ChartType = SeriesChartType.Line;
series.IsValueShownAsLabel = chkshowlabel.Checked;
lqtChart2.Series.Add(series);
IList<ForecastSummaryData> currentSummary = GetForecastSummaryByTA(ta);
foreach (ForecastSummaryData fsd in currentSummary)
{
lqtChart2.Series[ta].Points.AddXY(fsd.DurationDateTime, fsd.NoOfTest);
}
}
lqtChart2.Titles[0].Text = _chartTitle;
}
示例9: AddPoints
public void AddPoints(IEnumerable<int> points, Color? color = null)
{
var chartPoints = new Series { ChartType = SeriesChartType.Point, MarkerSize = 7, IsVisibleInLegend = false};
if (color.HasValue) chartPoints.Color = color.Value;
foreach (var point in points) chartPoints.Points.AddXY(point, 0);
Series.Add(chartPoints);
}
示例10: chart1_Load
private void chart1_Load(object sender, EventArgs e)
{
var listOfPeople = new People().GetPopleFromTextFile();
var list = new List<int>();
// chart1.BackColor=System.Drawing.Color.Black;
chart1.Titles.Add("People Alive");
foreach (var person in listOfPeople)
{
list.Add(person.end);
// Add point.
}
chart1.Series.Clear();
var series1 = new System.Windows.Forms.DataVisualization.Charting.Series
{
Name = "Age",
Color = System.Drawing.Color.Green,
IsVisibleInLegend = true,
IsXValueIndexed = true,
ChartType = SeriesChartType.Bar
};
this.chart1.Series.Add(series1);
foreach (var person in listOfPeople)
{
int age = person.end - person.Birth;
series1.Points.AddXY(person.end, age);
}
}
示例11: AddPlot
public void AddPlot(List<double> values, string title = "")
{
Chart chart = new Chart();
Series series = new Series();
ChartArea chartArea1 = new ChartArea();
chartArea1.Name = "ChartArea1";
chart.ChartAreas.Add(chartArea1);
series.BorderWidth = 2;
series.BorderDashStyle = ChartDashStyle.Solid;
series.ChartType = SeriesChartType.Line;
series.Color = Color.Green;
for (int i = 0; i < values.Count; i++)
{
series.Points.AddXY(i, values[i]);
}
chart.BorderlineColor = Color.Red;
chart.BorderlineWidth = 1;
chart.Series.Add(series);
chart.Titles.Add(title);
chart.Invalidate();
chart.Palette = ChartColorPalette.Fire;
chartArea1.AxisY.Minimum = values.Min();
chartArea1.AxisY.Maximum = values.Max();
AddChartInRuntime(chart);
}
示例12: btnShowCorrelogram_Click
private void btnShowCorrelogram_Click(object sender, EventArgs e)
{
var ts = new TimeSeries(TimeSeriesEnvironment.Current.TimeSeries, false);
int k;
if (!int.TryParse(txtCorrelogramK.Text, out k) || k < 0 || k > ts.Count - 1)
{
MessageBox.Show("Incorrect K variable for processing correlogram.");
return;
}
var cor = RandomExcerptChecker.GetCorrelogram(ts.Excerpt, k);
Series crlgrm = new Series("TS Correlogram")
{
ChartType = SeriesChartType.Column
};
dgCorrelation.Rows.Clear();
for (int i = 0; i < cor.Count; i++)
{
crlgrm.Points.AddXY(i, cor[i]);
var res = RandomExcerptChecker.TestCorrelation(cor[i], ts.Count, i);
dgCorrelation.Rows.Add(i,
string.Format("|{0:0.0000}|", res.Statistics),
res.IsRandom ? "≤" : ">",
res.Quantile.ToString("0.0000"));
}
chartTS.Series.Clear();
chartTS.Series.Add(crlgrm);
chartTS.ResetAutoValues();
}
示例13: button1_Click
private void button1_Click(object sender, EventArgs e)
{
// generate URL
string brand = comboBox1.Text;
string fromDate = comboBox2.Text + "-" + comboBox3.Text + "-" + comboBox4.Text;
string toDate = comboBox7.Text + "-" + comboBox6.Text + "-" + comboBox5.Text;
string url = "https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20%3D%20%22"
+ brand + "%22%20and%20startDate%20%3D%20%22"
+ fromDate + "%22%20and%20endDate%20%3D%20%22"
+ toDate + "%22&format=xml&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys";
// get and parse XML
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string xml = wc.DownloadString(url);
XDocument doc = XDocument.Parse(xml);
// set chart data
Series chartSetting = new Series();
chartSetting.ChartType = SeriesChartType.Line;
var quotes = doc.Descendants("quote");
foreach (var quote in quotes)
chartSetting.Points.AddXY(quote.Element("Date").Value, quote.Element("Close").Value);
chart1.Series.Clear();
chart1.Series.Add(chartSetting);
chart1.ChartAreas[0].AxisX.IsReversed = true;
}
示例14: CenterGravity
public CenterGravity()
{
InitializeComponent();
Chart chart = new Chart();
ChartArea area = new ChartArea();
area.AxisX.Title = "t";
area.AxisX.Minimum = 0;
area.AxisX.MajorGrid.LineColor = Color.LightGray;
area.AxisY.Title = "Movement";
area.AxisY.MajorGrid.LineColor = Color.LightGray;
chart.ChartAreas.Add(area);
_serie = new Series();
_serie.ChartType = SeriesChartType.Line;
_serie.MarkerStyle = MarkerStyle.Diamond;
_serie.MarkerSize = 9;
_serie.Color = Color.LimeGreen;
chart.Series.Add(_serie);
WindowsFormsHost host = new WindowsFormsHost();
host.Child = chart;
movlive.Children.Add(host);
_cog = new cog(400, 400);
coglive.Children.Add(_cog);
_first = true;
MainController.GetInstance.DataController.AddSensorDataListener(this);
}
示例15: ActualizeStats
public void ActualizeStats(Dictionary<string, int> ressourcesGathered)
{
if (GatherPie.InvokeRequired)
{
Invoke(new DelegGatherPie(ActualizeStats), ressourcesGathered);
return;
}
if (GatherPie.Titles.Count < 1)
GatherPie.Titles.Add("Ressources");
GatherPie.Series.Clear();
GatherPie.ChartAreas[0].BackColor = Color.Transparent;
Series series1 = new Series
{
Name = "series1",
IsVisibleInLegend = true,
Color = System.Drawing.Color.DeepSkyBlue,
ChartType = SeriesChartType.Pie
};
GatherPie.Series.Add(series1);
for (int z = 0; z < ressourcesGathered.Keys.Count; z++)
{
if (!job.CanGatherThis(ressourcesGathered.Keys.ToList()[z]))
ressourcesGathered.Remove(ressourcesGathered.Keys.ToList()[z]);
}
int i =0;
foreach (KeyValuePair<string,int> pair in ressourcesGathered)
{
series1.Points.Add(pair.Value);
var p1 = series1.Points[i];
p1.AxisLabel = pair.Key + " (" + pair.Value + ")";
p1.LegendText = pair.Key;
i += 1;
}
GatherPie.Invalidate();
}