本文整理汇总了C#中System.Windows.Forms.DataVisualization.Charting.Title类的典型用法代码示例。如果您正苦于以下问题:C# Title类的具体用法?C# Title怎么用?C# Title使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Title类属于System.Windows.Forms.DataVisualization.Charting命名空间,在下文中一共展示了Title类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: 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";
}
示例3: MadeChart
public void MadeChart(Chart chart, int band, int[] chartData)
{
Series series = new Series {ChartType = SeriesChartType.SplineArea};
Title title;
switch (_type)
{
case 2:
title = new Title
{
Text = "遥感图像累计直方图 · 波段:" + band,
TextStyle = TextStyle.Shadow,
Font = new Font(new FontFamily("微软雅黑"), 10)
};
break;
case 1:
default:
title = new Title
{
Text = "遥感图像直方图 · 波段:" + band,
TextStyle = TextStyle.Shadow,
Font = new Font(new FontFamily("微软雅黑"), 10)
};
break;
}
for (int i = 1; i < chartData.Length; i++)
{
series.Points.AddXY(i, chartData[i]);
}
chart.Series.Add(series);
chart.Titles.Add(title);
chart.Refresh();
}
示例4: 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;
}
示例5: CreatePlotAndSave
private static void CreatePlotAndSave(TestItem testItem)
{
// Create a Chart
var chart = new Chart();
// Chart title
var chartTitle = new Title(testItem.Label);
chart.Titles.Add(chartTitle);
// Create Chart Area
ChartArea chartArea = new ChartArea();
chartArea.AxisX.Title = "Milestone title";
chartArea.AxisY.Title = "ms";
chartArea.AxisX.IsMarginVisible = false;
for (int i = 0; i < testItem.MilestoneLabels.Length;i++)
{
chartArea.AxisX.CustomLabels.Add(i + 0.5, i + 1.5, testItem.MilestoneLabels[i]);
}
// Legend
Legend legend = new Legend("default");
legend.Docking = Docking.Bottom;
chart.Legends.Add(legend);
// Add Chart Area to the Chart
chart.ChartAreas.Add(chartArea);
foreach (var line in testItem.Lines)
{
Series series = new Series();
series.Legend = "default";
series.LegendText = line.Label;
series.ChartType = SeriesChartType.Line;
series.MarkerStyle = MarkerStyle.Circle;
series.BorderWidth = 2;
series.MarkerSize = 5;
for (int i = 0; i < line.Points.Length; i++)
{
series.Points.Add(line.Points[i].GetMinTime());
}
chart.Series.Add(series);
}
// Set chart control location
chart.Location = new System.Drawing.Point(16, 48);
// Set Chart control size
chart.Size = new System.Drawing.Size(400, 300);
var fileName = GenerateFileName(testItem);
var file = new FileStream(fileName, FileMode.Create);
chart.SaveImage(file, ChartImageFormat.Png);
file.Close();
Console.WriteLine(String.Format("Report: \"{0}\" created.", fileName));
}
示例6: Form1
public Form1()
{
InitializeComponent();
// clear
chart1.Series.Clear();
chart1.ChartAreas.Clear();
chart1.Titles.Clear();
// chartarea
ChartArea area1 = new ChartArea("Area1");
area1.AxisX.Title = "Title1-XAxis";
area1.AxisY.Title = "Title1-YAxis";
ChartArea area2 = new ChartArea("Area2");
area2.AxisX.Title = "Title2-XAxis";
area2.AxisY.Title = "Title2-YAxis";
Title title = new Title("Title");
Title title1 = new Title("Title1");
Title title2 = new Title("Title2");
title1.DockedToChartArea = "Area1"; // ChartAreaとの紐付
title2.DockedToChartArea = "Area2"; // ChartAreaとの紐付
// series
Random rdm = new Random();
Series seriesLine = new Series();
seriesLine.ChartType = SeriesChartType.Line;
seriesLine.LegendText = "Legend:Line";
seriesLine.BorderWidth = 2;
seriesLine.MarkerStyle = MarkerStyle.Circle;
seriesLine.MarkerSize = 12;
for (int i = 0; i < 10; i++)
{
seriesLine.Points.Add(new DataPoint(i, rdm.Next(0, 210)));
}
seriesLine.ChartArea = "Area1"; // ChartAreaとの紐付
Series seriesColumn = new Series();
seriesColumn.LegendText = "Legend:Column";
seriesColumn.ChartType = SeriesChartType.Column;
for (int i = 0; i < 10; i++)
{
seriesColumn.Points.Add(new DataPoint(i, rdm.Next(0, 210)));
}
seriesColumn.ChartArea = "Area2"; // ChartAreaとの紐付
chart1.Titles.Add(title);
chart1.Titles.Add(title1);
chart1.Titles.Add(title2);
chart1.ChartAreas.Add(area1);
chart1.ChartAreas.Add(area2);
chart1.Series.Add(seriesColumn);
chart1.Series.Add(seriesLine);
}
示例7: AddTitle
private void AddTitle(Chart chart, string text)
{
var title = new Title
{
Text = text,
Font = new Font("Arial", 7f, FontStyle.Bold),
ForeColor = Color.FromArgb(45, 45, 48),
Docking = Docking.Bottom,
};
chart.Titles.Add(title);
}
示例8: BuildChartPie
private void BuildChartPie()
{
ChartArea chartArea1 = new ChartArea();
chartArea1.Area3DStyle.IsClustered = true;
chartArea1.Area3DStyle.IsRightAngleAxes = false;
chartArea1.Area3DStyle.Perspective = 10;
chartArea1.Area3DStyle.PointGapDepth = 0;
chartArea1.Area3DStyle.Rotation = 0;
chartArea1.Area3DStyle.WallWidth = 0;
chartArea1.AxisX.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
chartArea1.AxisX.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisX.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisY.LabelStyle.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
chartArea1.AxisY.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.AxisY.MajorGrid.LineColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.BackColor = System.Drawing.Color.Transparent;
chartArea1.BackSecondaryColor = System.Drawing.Color.Transparent;
chartArea1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
chartArea1.BorderWidth = 0;
chartArea1.Name = "Default";
chartArea1.ShadowColor = System.Drawing.Color.Transparent;
this.chartPie.ChartAreas.Add(chartArea1);
Legend legend1 = new Legend();
legend1.Alignment = System.Drawing.StringAlignment.Center;
legend1.BackColor = System.Drawing.Color.Transparent;
legend1.Docking = Docking.Bottom;
legend1.Enabled = true;
legend1.Font = new System.Drawing.Font("Trebuchet MS", 8.25F, System.Drawing.FontStyle.Bold);
legend1.IsTextAutoFit = true;
legend1.Name = "Default";
this.chartPie.Legends.Add(legend1);
Title title1 = new Title();
title1.Font = new System.Drawing.Font("Trebuchet MS", 14.25F, System.Drawing.FontStyle.Bold);
title1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
title1.Name = "Title";
title1.ShadowColor = System.Drawing.Color.FromArgb(((int)(((byte)(32)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
title1.ShadowOffset = 3;
title1.Text = "销量前十的产品统计饼图";
this.chartPie.Titles.Add(title1);
Series series1 = new Series();
series1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(26)))), ((int)(((byte)(59)))), ((int)(((byte)(105)))));
series1.ChartArea = "Default";
series1["PieLabelStyle"] = "Outside";
series1["PieDrawingStyle"] = "Concave";
series1.ChartType = SeriesChartType.Pie;
series1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(220)))), ((int)(((byte)(65)))), ((int)(((byte)(140)))), ((int)(((byte)(240)))));
series1.Legend = "Default";
series1.Name = "Default";
this.chartPie.Series.Add(series1);
}
示例9: FormChart
public FormChart(string title)
{
InitializeComponent();
Title t = new Title(title);
t.Font = new System.Drawing.Font(t.Font.FontFamily, 20f);
chartPlot.Titles.Add(t);
labelOptimal.Text = string.Empty;
labelSchedulable.Text = string.Empty;
labelMinPi.Text = string.Empty;
labelMinEms.Text = string.Empty;
labelMinTms.Text = string.Empty;
}
示例10: CreateGraph
//Creating a fun little graph
public static void CreateGraph(YearMap yearMap)
{
//Order the list of keys to get all of the years and find out how many years there were that someone lived in
var orderedList = yearMap.YearVals.Keys.OrderBy(x => x).ToArray();
var numberOfYears = orderedList.Count();
var xvals = new int[numberOfYears];
var yvals = new int[numberOfYears];
for (int i = 0; i < yvals.Length; i++)
{
yvals[i] = yearMap.YearVals[orderedList[i]];
xvals[i] = orderedList[i];
}
var chart = new Chart();
chart.Size = new Size(1000, 1000);
Title title = new Title("Number of people alive each year");
title.Font = new Font("Calibri", 16, System.Drawing.FontStyle.Bold);
chart.Titles.Add(title);
var chartArea = new ChartArea();
chartArea.AxisX.LabelStyle.Font = new Font("Calibri", 8);
chartArea.AxisY.LabelStyle.Font = new Font("Calibri", 8);
chartArea.AxisY.Minimum = 0;
chartArea.AxisX.Minimum = 1900;
chartArea.AxisX.Maximum = 2000;
chartArea.AxisX.Title = "Years";
chartArea.AxisX.TitleFont = new Font("Calibri", 14, System.Drawing.FontStyle.Bold);
chartArea.AxisY.Title = "Number of People Alive";
chartArea.AxisY.TitleFont = new Font("Calibri", 14, System.Drawing.FontStyle.Bold);
chartArea.AxisY.Interval = 1;
chartArea.AxisX.Interval = 5;
chart.ChartAreas.Add(chartArea);
var series = new Series();
series.Name = "Series";
series.ChartType = SeriesChartType.Bar;
chart.Series.Add(series);
chart.Series["Series"].Points.DataBindXY(xvals, yvals);
chart.Invalidate();
chart.SaveImage("../../Output/chart.png", ChartImageFormat.Png);
}
示例11: GetChart
public Chart GetChart(int DescriptorIdx)
{
//if (ListDescriptors[CurrentDescriptorToDisplay].GetAssociatedType().GetBinNumber() == 1) return null;
List<double[]> CurrentHisto = GetValues(DescriptorIdx).CreateHistogram(100, false);
Series CurrentSeries = new Series();
//CurrentSeries.ShadowOffset = 2;
for (int IdxValue = 0; IdxValue < CurrentHisto[0].Length; IdxValue++)
CurrentSeries.Points.AddXY(CurrentHisto[0][IdxValue], CurrentHisto[1][IdxValue]);
ChartArea CurrentChartArea = new ChartArea("ChartArea" + DescriptorIdx);
CurrentChartArea.BorderColor = Color.White;
Chart ChartToReturn = new Chart();
ChartToReturn.ChartAreas.Add(CurrentChartArea);
// ChartToReturn.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
CurrentChartArea.BackColor = Color.White;
CurrentChartArea.Axes[1].LabelStyle.Enabled = false;
CurrentChartArea.Axes[1].MajorGrid.Enabled = false;
CurrentChartArea.Axes[0].Enabled = AxisEnabled.False;
CurrentChartArea.Axes[1].Enabled = AxisEnabled.False;
CurrentChartArea.Axes[0].MajorGrid.Enabled = false;
// CurrentChartArea.Axes[0].Title = ListDescriptors[CurrentDescriptorToDisplay].GetName();
CurrentSeries.ChartType = SeriesChartType.Line;
CurrentSeries.Color = Color.Black;
// CurrentSeries.BorderWidth = 3;
CurrentSeries.ChartArea = "ChartArea" + DescriptorIdx;
// CurrentSeries.Name = "Series" + PosX + "x" + PosY;
ChartToReturn.Series.Add(CurrentSeries);
Title CurrentTitle = new Title("Reference");
// ChartToReturn.Titles.Add(CurrentTitle);
// ChartToReturn.Width = 100;
// ChartToReturn.Height = 48;
// ChartToReturn.Update();
// ChartToReturn.Show();
return ChartToReturn;
}
示例12: Form1
public Form1()
{
InitializeComponent();
// clear
chart1.Series.Clear();
chart1.ChartAreas.Clear();
chart1.Titles.Clear();
Title title1 = new Title("Histgram");
// series
Series seriesColumn = new Series();
seriesColumn.LegendText = "Histgram";
seriesColumn.ChartType = SeriesChartType.Column;
// 正規乱数を作る
mRand = new Random(DateTime.Now.Millisecond);
int nData = 10000;
double[] data = new double[nData];
for (int i = 0; i < nData; i++)
{
// Box-Muller法で一様乱数から正規乱数を作る
data[i] = boxmuller(mRand, 0 /* average */ , 10 /* sigma */);
}
// ヒストグラムを作る
int nBuckets = 10;
Histogram hist = new Histogram(data, nBuckets, -50 /* lower */, 50 /* upper */);
for (int i = 0; i < nBuckets; i++)
{
double mid = Math.Round((hist[i].UpperBound+hist[i].LowerBound)/2, 1);
seriesColumn.Points.Add(new DataPoint(mid, hist[i].Count));
}
// chartarea
ChartArea area1 = new ChartArea();
area1.AxisX.Title = "Value";
area1.AxisY.Title = "Frequency";
chart1.Titles.Add(title1);
chart1.ChartAreas.Add(area1);
chart1.Series.Add(seriesColumn);
}
示例13: tmpContrast_Load
private void tmpContrast_Load(object sender, EventArgs e)
{
Series sr = new Series("对比度") {ChartType = SeriesChartType.Line};
Title t = new Title("1-7波段对比度")
{
TextStyle = TextStyle.Shadow,
Font = new Font(new FontFamily("微软雅黑"), 15)
};
for (int i = 0; i < _data.Length; i++)
{
sr.Points.AddXY(i + 1, _data[i]);
}
chart1.Series.Add(sr);
chart1.Titles.Add(t);
chart1.Refresh();
}
示例14: GenerateChart
public static void GenerateChart(ChartParamterers parameters, string resultPath)
{
var csvPath = string.Format("{0}.csv", resultPath);
var records = ReadDataFromFile(csvPath);
var myChart = new Chart
{
Size = ChartSize
};
var myChartArea = new ChartArea();
myChart.ChartAreas.Add(myChartArea);
var series = new Series("default")
{
ChartType = parameters.ChartType
};
foreach (var thing in records)
{
series.Points.AddXY(thing.X.Length > 25 ? thing.X.Substring(0, 25) : thing.X, thing.Y);
}
myChart.Series.Add(series);
if (parameters.AllValuesInXInterval)
{
myChart.ChartAreas[0].AxisX.Interval = 1;
}
var font = new Font("Arial", 12, FontStyle.Bold);
var title = new Title
{
Text = resultPath,
Font = font
};
myChart.Titles.Add(title);
var pngPath = string.Format("{0}.png", resultPath);
myChart.SaveImage(pngPath, ChartImageFormat.Png);
}
示例15: CreateLinearChart
private Chart CreateLinearChart(Legend legend, Title title, Dictionary<DateTime, int> dpc)
{
var chart = new Chart();
chart.Size = new Size(800, 250);
chart.Titles.Add(title);
var chartArea = new ChartArea();
chartArea.AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
chart.ChartAreas.Add(chartArea);
var series = new Series();
series.Name = "Number of events";
series.ChartType = SeriesChartType.Line;
chart.Legends.Add(legend);
chart.Series.Add(series);
foreach (var entry in dpc)
chart.Series["Number of events"].Points.AddXY(entry.Key, entry.Value);
chart.Dock = DockStyle.Fill;
return chart;
}