本文整理汇总了C#中System.Windows.Forms.DataVisualization.Charting.ChartArea类的典型用法代码示例。如果您正苦于以下问题:C# ChartArea类的具体用法?C# ChartArea怎么用?C# ChartArea使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ChartArea类属于System.Windows.Forms.DataVisualization.Charting命名空间,在下文中一共展示了ChartArea类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: Init
private void Init()
{
ChartArea chartArea = new ChartArea();
Legend legend = new Legend();
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
chartArea.Name = "ChartArea1";
this.ChartAreas.Add(chartArea);
legend.Name = "Legend1";
this.Legends.Add(legend);
Series.Clear();
m_series = new Series
{
Name = "Series1",
Color = System.Drawing.Color.Green,
IsVisibleInLegend = false,
IsXValueIndexed = true,
ChartType = SeriesChartType.Line
};
Series.Add(m_series);
for (int i = 10; i < 23; i++)
{
m_series.Points.AddXY(i, f(i));
}
}
示例3: 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;
}
示例4: 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);
}
示例5: ChartPanel
public ChartPanel(MetingType type, SeriesChartType charttype)
: base()
{
this.type = type;
this.ChartType = charttype;
this.chart = new Chart();
this.chartArea = new ChartArea();
this.chart.Titles.Add(new Title(type.ToString()));
this.Location = new System.Drawing.Point(0, 0);
this.Size = new System.Drawing.Size(400, 250);
this.Controls.Add(chart);
this.series = createSerie();
this.chartArea.Name = "chartArea";
this.chart.Size = new System.Drawing.Size(400, 250);
this.chart.Dock = DockStyle.Fill;
this.chart.Series.Add(series);
this.chart.Text = "chart";
this.chart.ChartAreas.Add(chartArea);
}
示例6: MyChartControl
/// <summary>
/// Initialises a new instance of the class
/// </summary>
public MyChartControl()
{
InitializeComponent();
_candles = new List<OHLC>();
_mainChartArea = chartCtrl.ChartAreas[Constants.CandleAreaName];
chartCtrl.MouseWheel += chartCtrl_MouseWheel;
chartCtrl.MouseEnter += (s, e) =>
{
if (!chartCtrl.Focused)
chartCtrl.Focus();
};
chartCtrl.MouseLeave += (s, e) =>
{
if (chartCtrl.Focused)
{
chartCtrl.Parent.Focus();
}
_mainChartArea.CursorX.Position = _mainChartArea.CursorY.Position = -10;
_priceAnnotation.X = _priceAnnotation.Y = -10;
lblInfo.Text = string.Empty;
};
chartCtrl.MouseMove += chartCtrl_MouseMove;
InitChart();
}
示例7: CreateChart
private void CreateChart()
{
// Создаём новую область для построения графика
ChartArea area = new ChartArea
{
// Даём ей имя (чтобы потом добавлять графики)
Name = "myGraph",
AxisX =
{
// Задаём левую и правую границы оси X
Minimum = 0,
Maximum = 10,
// Определяем шаг сетки
MajorGrid = {Interval = 1}
}
};
// Добавляем область в диаграмму
chart1.ChartAreas.Add(area);
// Создаём объект для первого графика
Series series1 = new Series
{
ChartArea = "myGraph",
ChartType = SeriesChartType.Column,
BorderWidth = 3,
LegendText = "гистограмма"
};
chart1.Series.Add(series1);
}
示例8: ChartExtents
internal ChartExtents(ChartArea ptrChartArea, bool justVisible)
{
var primary = GetBoundariesOfDataCore(ptrChartArea.AxisX, ptrChartArea.AxisY, justVisible);
var secondary = GetBoundariesOfDataCore(ptrChartArea.AxisX2, ptrChartArea.AxisY2, justVisible);
PrimaryExtents = primary;
SecondaryExtents = secondary;
}
示例9: MultipleGraphics
public MultipleGraphics(ResultResearch r)
{
InitializeComponent();
this.research = r;
SortedDictionary<double, SortedDictionary<double, SubGraphsInfo>>.KeyCollection keys =
this.research.Result.Keys;
foreach (double k in keys)
{
Chart graphic = new Chart();
graphic.Titles.Add("Network Size = " + this.research.Size.ToString());
ChartArea chArea = new ChartArea("Current Level = " + k.ToString());
chArea.AxisX.Title = "Mu";
chArea.AxisY.Title = "Order";
graphic.ChartAreas.Add(chArea);
Series s = new Series("Current Level = " + k.ToString());
s.ChartType = SeriesChartType.Line;
s.Color = Color.Red;
foreach (KeyValuePair<double, SubGraphsInfo> v in this.research.Result[k])
{
s.Points.Add(new DataPoint(v.Key, v.Value.avgOrder));
}
graphic.Series.Add(s);
graphic.Dock = DockStyle.Fill;
TabPage page = new TabPage("Current Level = " + k.ToString());
page.Controls.Add(graphic);
this.graphicsTab.TabPages.Add(page);
this.graphics.Add(graphic);
}
}
示例10: GenerateChart
private void GenerateChart(SeriesCreator creator, string filePath)
{
IEnumerable<Series> serieses = creator.ToSerieses();
using (var ch = new Chart())
{
ch.Size = new Size(1300, 800);
ch.AntiAliasing = AntiAliasingStyles.All;
ch.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
ch.Palette = ChartColorPalette.BrightPastel;
ChartArea area = new ChartArea();
area.AxisX.MajorGrid.Enabled = false;
area.AxisY.MajorGrid.Enabled = false;
area.AxisY.Minimum = creator.GetMinimumY();
ch.ChartAreas.Add(area);
Legend legend = new Legend();
legend.Font = new Font("Microsoft Sans Serif", 12, FontStyle.Regular);
ch.Legends.Add(legend);
foreach (var s in serieses)
{
ch.Series.Add(s);
}
string savePath = filePath + ".png";
ch.SaveImage(savePath, ChartImageFormat.Png);
}
}
示例11: MSChartExtensionZoomDialog
public MSChartExtensionZoomDialog(ChartArea sender)
{
InitializeComponent();
ptrChartArea = sender;
cbAxisType.SelectedIndex = 0;
cbAxisType_SelectedIndexChanged(this, null);
}
示例12: PrettyChart
public PrettyChart()
{
var title1 = new Title {Name = "Title1", Text = "<TITLE>"};
Titles.Add(title1);
var area = new ChartArea();
area.AxisY.LabelStyle.Enabled = true;
area.AxisY.Interval = 1.0;
area.AxisX.LabelStyle.Enabled = true;
area.Name = "ChartArea2";
var legend1 = new Legend {Alignment = StringAlignment.Center, Docking = Docking.Top, Name = "Legend1"};
Legends.Add(legend1);
var series2 = new Series
{
ChartArea = "ChartArea2",
Color = Color.Blue,
Legend = "Legend1",
Name = "Series2",
XValueType = ChartValueType.Int32
};
ChartAreas.Add(area);
Series.Add(series2);
Dock = DockStyle.Fill;
Location = new Point(0, 0);
Titles[0].Text = "Age Distribution";
Series[0].Name = "Number of People";
}
示例13: AddChartsToProgressControl
/* Adds one tab containing a chart to this.progressTabControl for each member in chartName.
* Returns a list of the added charts.
*/
private List<Chart> AddChartsToProgressControl(List<string> chartNames)
{
int i = 0;
List<Chart> charts = new List<Chart>();
foreach (string chartName in chartNames)
{
Legend legend = new Legend();
legend.Name = "legend";
legend.Docking = Docking.Right;
ChartArea ca = new ChartArea();
ca.Name = "chartArea";
Chart chart = new Chart();
chart.Legends.Add(legend);
chart.ChartAreas.Add(ca);
chart.Name = chartName;
chart.Dock = DockStyle.Fill;
chart.Text = chartName;
TabPage tPage = new TabPage();
tPage.Name = chartName;
tPage.Text = chartName;
tPage.Controls.Add(chart);
this.progressTabControl.Controls.Add(tPage);
charts.Add(chart);
i++;
}
return charts;
}
示例14: CreatePieChart
private Chart CreatePieChart(Legend legend, Title title, Dictionary<string, int> dpc)
{
var chart = new Chart();
chart.Size = new Size(600, 450);
chart.Titles.Add(title);
var chartArea = new ChartArea();
chart.ChartAreas.Add(chartArea);
var series = new Series();
series.Name = "series";
series.ChartType = SeriesChartType.Pie;
//chart.Legends.Add(legend);
chart.Series.Add(series);
foreach (var entry in dpc)
{
if(entry.Value > 0)
chart.Series["series"].Points.AddXY(entry.Key, entry.Value);
}
chart.Dock = DockStyle.Fill;
return chart;
}
示例15: InitializeChart
public void InitializeChart()
{
this.components = new System.ComponentModel.Container();
ChartArea chartArea1 = new ChartArea();
Legend legend1 = new Legend() { BackColor = Color.Green, ForeColor = Color.Black, Title = "Salary" };
Legend legend2 = new Legend() { BackColor = Color.Green, ForeColor = Color.Black, Title = "Salary" };
barChart = new Chart();
((ISupportInitialize)(barChart)).BeginInit();
SuspendLayout();
//====Bar Chart
chartArea1 = new ChartArea();
chartArea1.Name = "BarChartArea";
barChart.ChartAreas.Add(chartArea1);
barChart.Dock = System.Windows.Forms.DockStyle.Fill;
legend2.Name = "Legend3";
barChart.Legends.Add(legend2);
AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
//this.ClientSize = new System.Drawing.Size(284, 262);
this.Load += new EventHandler(Form3_Load);
((ISupportInitialize)(this.barChart)).EndInit();
this.ResumeLayout(false);
}
开发者ID:statavarthy,项目名称:Project-Life-Expectancy-Based-on-SocioEconomic-Indicators,代码行数:26,代码来源:Form3.cs