本文整理汇总了C#中DataSeries.Add方法的典型用法代码示例。如果您正苦于以下问题:C# DataSeries.Add方法的具体用法?C# DataSeries.Add怎么用?C# DataSeries.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSeries
的用法示例。
在下文中一共展示了DataSeries.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FillWithSampleBubbleData
public static void FillWithSampleBubbleData(DataSeries series)
{
series.Add(new DataPoint { YValue = 20, BubbleSize = 40 });
series.Add(new DataPoint { YValue = 40, BubbleSize = 80 });
series.Add(new DataPoint { YValue = 80, BubbleSize = 20 });
series.Add(new DataPoint { YValue = 60, BubbleSize = 100 });
series.Add(new DataPoint { YValue = 10, BubbleSize = 20 });
}
示例2: SolveDiffEquation
public void SolveDiffEquation(double T, double b, double sigma, double f, int n)
{
try
{
double[] u = new double[n + 1];
u[0] = 0;
u[n] = 0;
var coefficients = FindCoefficients(T, b, sigma, f, n).Reverse().ToArray();
for (int i = 1; i < n; i++)
{
double sum = 0;
for (int j = 1; j < n; j++)
{
double x = (double)i / n;
sum += coefficients[j - 1]*CourantFun(x, n, j);
}
u[i] = sum;
}
DataSeries<double, double> fun = new DataSeries<double, double>("u(x)");
for (int i = 0; i < n + 1; i++)
{
fun.Add(new DataPoint<double, double>() { X = (double)i / n, Y = u[i] });
}
exampleChart.Series[0].DataSeries = fun;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例3: GenerateDataSeries
public void GenerateDataSeries(Dictionary<string,double> data, ChartBy chartBy)
{
var series = new DataSeries<string, double>();
foreach (var d in data)
{
series.Add(new DataPoint<string, double>((chartBy == ChartBy.Cols ? "Column " : "Row ") + d.Key, d.Value));
}
MainChart.DataSeries = series;
}
示例4: addSerise
private void addSerise()
{
DataSeries series = new DataSeries();
series.Definition = new LineSeriesDefinition();
series.LegendLabel = "温度";
for (int i = 1; i < 20; i++)
{
series.Add(new DataPoint(DateTime.Now.AddMinutes(i).ToString("HH:mm:00"), i * i));
}
radChart.DefaultView.ChartArea.DataSeries.Add(series);
}
示例5: FillWithSampleData
public static void FillWithSampleData(DataSeries series, int numberOfItems, int max, int deviation)
{
Random random = new Random((int)(series.GetHashCode() + DateTime.Now.Ticks));
if (deviation > max)
deviation = max;
for (int i = 0; i < numberOfItems; i++)
{
series.Add(new DataPoint(random.Next(max - deviation, max)));
}
}
示例6: Data
private void Data()
{
DataSeries series = new DataSeries();
series.Definition = new Pie3DSeriesDefinition();// DoughnutSeriesDefinition();// Doughnut3DSeriesDefinition();// PieSeriesDefinition();// Pie3DSeriesDefinition();
radChart.Width = 600;
radChart.Height = 300;
for (int i = 1; i < 4; i++)
{
series.Add(new DataPoint(i, i * i));
}
radChart.DefaultView.ChartArea.DataSeries.Add(series);
}
示例7: FillWithSampleBubbleMixedData
public static void FillWithSampleBubbleMixedData(DataSeries series)
{
series.Add(new DataPoint { YValue = 75, BubbleSize = -60 });
series.Add(new DataPoint { YValue = 10, BubbleSize = 40 });
series.Add(new DataPoint { YValue = 40, BubbleSize = -60 });
series.Add(new DataPoint { YValue = 20, BubbleSize = 50 });
series.Add(new DataPoint { YValue = 50, BubbleSize = 80 });
series.Add(new DataPoint { YValue = 30, BubbleSize = -40 });
}
示例8: Button_Click_1
private void Button_Click_1(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == true)
{
TextBox_InputName.Text = ofd.FileName;
FFTW fftw = new FFTW();
_input = DataLoader.Load(ofd.FileName);
double[] inputCopy = new double[_input.Length];
_input.CopyTo(inputCopy, 0);
_frequencyDomain = fftw.Forward(inputCopy);
_frequencyDomainLinkedToCheckboxes = new Complex[_frequencyDomain.Length];
_frequencyDomain.CopyTo(_frequencyDomainLinkedToCheckboxes, 0);
DataSeries<double, double> points = new DataSeries<double, double>("Magnitudes");
TheList = new ObservableCollection<CheckBoxBinder>();
List<CheckBoxBinder> mags = new List<CheckBoxBinder>();
for (int c = 0; c < _frequencyDomain.Length; c++)
{
points.Add(new DataPoint<double, double> { X = c, Y = _frequencyDomain[c].Magnitude });
mags.Add(new CheckBoxBinder { TheValue = _frequencyDomain[c].Magnitude, Index = c });
}
foreach (CheckBoxBinder d in mags.OrderByDescending(m => m.TheValue))
{
TheList.Add(d);
}
exampleChart.Series[0].DataSeries = points;
this.DataContext = this;
DataSeries<double, double> data = new DataSeries<double, double>("Data");
for (int c = 0; c < _input.Length; c++)
{
data.Add(new DataPoint<double, double> { X = c, Y = _input[c] });
}
dataChart.Series[0].DataSeries = data;
return;
}
}
示例9: MainPage
public MainPage()
{
InitializeComponent();
DataSeries lineSeries = new DataSeries();
lineSeries.LegendLabel = "Monthly Sales";
lineSeries.Definition = new LineSeriesDefinition();
Random r = new Random(0);
for (int i = 0; i < 12; i++)
{
lineSeries.Add(new DataPoint() { YValue = i + r.Next(0, 20) });
}
radChart.DefaultView.ChartArea.DataSeries.Add(lineSeries);
string[] months = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", };
for (int i = 0; i < months.Length; i++)
{
radChart.DefaultView.ChartArea.AxisX.TickPoints[i].Label = months[i];
}
}
示例10: ExportChart
private void ExportChart(DataSet sheet)
{
graph.Width = 800;
graph.Height = 600;
graph.Measure(new System.Windows.Size(graph.Width, graph.Height));
graph.Arrange(new System.Windows.Rect(graph.DesiredSize));
graph.DefaultView.ChartArea.EnableAnimations = false;
string semester = onBeginSheet ? " Beginning" : " End";
int num;
if (onBeginSheet)
{
string name = sheet.Tables[0].Columns[LeftToExportBegin].ColumnName.ToString();
foreach (char c in name)
{
if (int.TryParse(c.ToString(), out num))
name = name.Remove(name.IndexOf(c));
}
name = name.Trim();
graph.DefaultView.ChartTitle.Content = name + semester + " of Semester Results";
}
else
{
string name = sheet.Tables[0].Columns[LeftToExportEnd].ColumnName.ToString();
foreach (char c in name)
{
if (int.TryParse(c.ToString(), out num))
name = name.Remove(name.IndexOf(c));
}
name = name.Trim();
graph.DefaultView.ChartTitle.Content = name + semester + " of Semester Results";
}
graph.DefaultView.ChartTitle.HorizontalAlignment = HorizontalAlignment.Center;
graph.DefaultView.ChartLegend.UseAutoGeneratedItems = true;
DataSeries barSeries = new DataSeries();
barSeries.LegendLabel = "Results";
barSeries.Definition = new BarSeriesDefinition();
string complete, very, moderate, somewhat, notatall, norating;
if (onBeginSheet)
{
complete = sheet.Tables[0].Rows[startGraphBegin][LeftToExportBegin].ToString();
very = sheet.Tables[0].Rows[startGraphBegin + 1][LeftToExportBegin].ToString();
moderate = sheet.Tables[0].Rows[startGraphBegin + 2][LeftToExportBegin].ToString();
somewhat = sheet.Tables[0].Rows[startGraphBegin + 3][LeftToExportBegin].ToString();
notatall = sheet.Tables[0].Rows[startGraphBegin + 4][LeftToExportBegin].ToString();
norating = sheet.Tables[0].Rows[startGraphBegin + 5][LeftToExportBegin].ToString();
}
else
{
complete = sheet.Tables[0].Rows[startGraphEnd][LeftToExportEnd].ToString();
very = sheet.Tables[0].Rows[startGraphEnd + 1][LeftToExportEnd].ToString();
moderate = sheet.Tables[0].Rows[startGraphEnd + 2][LeftToExportEnd].ToString();
somewhat = sheet.Tables[0].Rows[startGraphEnd + 3][LeftToExportEnd].ToString();
notatall = sheet.Tables[0].Rows[startGraphEnd + 4][LeftToExportEnd].ToString();
norating = sheet.Tables[0].Rows[startGraphEnd + 5][LeftToExportEnd].ToString();
}
barSeries.Add(new DataPoint() { YValue = Convert.ToDouble(complete), XCategory = "Completely" });
barSeries.Add(new DataPoint() { YValue = Convert.ToDouble(very), XCategory = "Very" });
barSeries.Add(new DataPoint() { YValue = Convert.ToDouble(moderate), XCategory = "Moderately" });
barSeries.Add(new DataPoint() { YValue = Convert.ToDouble(somewhat), XCategory = "Somewhat" });
barSeries.Add(new DataPoint() { YValue = Convert.ToDouble(notatall), XCategory = "Not At All" });
barSeries.Add(new DataPoint() { YValue = Convert.ToDouble(norating), XCategory = "No Rating" });
graph.DefaultView.ChartArea.DataSeries.Add(barSeries);
Dispatcher.BeginInvoke((Action)(() =>
{
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Bar Charts\";
if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
using (FileStream fs = File.Create(filePath + graph.DefaultView.ChartTitle.Content.ToString() + ".png"))
{
if (onBeginSheet)
{
graph.ExportToImage(fs, new PngBitmapEncoder());
if (LeftToExportBegin == 1)
{
ExportBtn.IsEnabled = false;
if (importTwoGraphs)
{
onBeginSheet = false;
ExportInitialGraph();
}
LeftToExportText.Text = "Graphs successfully exported!";
}
else
ExportGraphs();
}
else
{
graph.ExportToImage(fs, new PngBitmapEncoder());
if (LeftToExportEnd == 1)
{
ExportBtn.IsEnabled = false;
LeftToExportText.Text = "Graphs successfully exported!";
}
else
ExportGraphs();
}
}
//.........这里部分代码省略.........
示例11: ExportBubbleGraph
public void ExportBubbleGraph()
{
BubbleGraph.Width = 800;
BubbleGraph.Height = 600;
BubbleGraph.Measure(new System.Windows.Size(BubbleGraph.Width, BubbleGraph.Height));
BubbleGraph.Arrange(new System.Windows.Rect(BubbleGraph.DesiredSize));
BubbleGraph.DefaultView.ChartArea.EnableAnimations = false;
BubbleGraph.DefaultView.ChartTitle.Content = onBeginSheet ? "Beginning of Semester Evaluation" : "End of Semester Evaluation";
BubbleGraph.DefaultView.ChartTitle.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
BubbleGraph.DefaultView.ChartLegend.UseAutoGeneratedItems = true;
DataSeries bubbleSeries = new DataSeries();
bubbleSeries.LegendLabel = "Evaluation";
bubbleSeries.Definition = new BubbleSeriesDefinition();
foreach (BubblePoints b in AllPoints)
{
bubbleSeries.Add(new DataPoint() { XValue = b.X, YValue = b.Y, BubbleSize = b.total * .25 });
}
BubbleGraph.DefaultView.ChartArea.DataSeries.Add(bubbleSeries);
Dispatcher.BeginInvoke((Action)(() =>
{
string filePath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\Bubble Graphs\";
if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
using (FileStream fs = File.Create(filePath + BubbleGraph.DefaultView.ChartTitle.Content.ToString() + ".png"))
{
if (importTwoGraphs && !SecondChartExported)
{
ExportSecondChart();
BubbleGraph.ExportToImage(fs, new PngBitmapEncoder());
}
else
BubbleGraph.ExportToImage(fs, new PngBitmapEncoder());
}
}), DispatcherPriority.ApplicationIdle, null);
}
示例12: refresh
public void refresh(ChartDataSerie serieData)
{
int count=0;
switch (silverChartControl.XAxesType) {
case XAxisTypeEnum.numeric:
DataSeries<double,double> dataSeries=new DataSeries<double, double> { Title = Name };
foreach (ChartDataPoint point in serieData.Points) {
dataSeries.Add(new DataPoint<double, double>(point.XValDouble, point.YVal));
count++;
}
if (Enabled) {
Serie.DataSeries = dataSeries;
}
SeriesData = dataSeries;
break;
case XAxisTypeEnum.datetime:
DataSeries<DateTime,double> dataSeriesDate=new DataSeries<DateTime, double> { Title = Name };
foreach (ChartDataPoint point in serieData.Points) {
dataSeriesDate.Add(new DataPoint<DateTime, double>(point.XVal, point.YVal));
count++;
}
if (Enabled) {
Serie.DataSeries = dataSeriesDate;
}
SeriesData = dataSeriesDate;
break;
}
ShowToolTip=count<100;
}
示例13: MainWindow
public MainWindow()
{
InitializeComponent();
telerikChart.DefaultView.ChartArea.AxisY.IsInverse = true;
telerikChart.DefaultView.ChartArea.AxisX.IsInverse = true;
//Line Chart
DataSeries lineSeries = new DataSeries();
lineSeries.LegendLabel = "Turnover";
lineSeries.Definition = new LineSeriesDefinition();
lineSeries.Add(new DataPoint() { YValue = 154, XCategory = "Jan" });
lineSeries.Add(new DataPoint() { YValue = 138, XCategory = "Feb" });
lineSeries.Add(new DataPoint() { YValue = 143, XCategory = "Mar" });
lineSeries.Add(new DataPoint() { YValue = 120, XCategory = "Apr" });
lineSeries.Add(new DataPoint() { YValue = 135, XCategory = "May" });
lineSeries.Add(new DataPoint() { YValue = 125, XCategory = "Jun" });
lineSeries.Add(new DataPoint() { YValue = 179, XCategory = "Jul" });
lineSeries.Add(new DataPoint() { YValue = 170, XCategory = "Aug" });
lineSeries.Add(new DataPoint() { YValue = 198, XCategory = "Sep" });
lineSeries.Add(new DataPoint() { YValue = 187, XCategory = "Oct" });
lineSeries.Add(new DataPoint() { YValue = 193, XCategory = "Nov" });
lineSeries.Add(new DataPoint() { YValue = 176, XCategory = "Dec" });
telerikChart.DefaultView.ChartArea.DataSeries.Add(lineSeries);
//Bar Chart
DataSeries barSeries = new DataSeries();
barSeries.LegendLabel = "Expenses";
barSeries.Definition = new BarSeriesDefinition();
barSeries.Add(new DataPoint() { YValue = 45, XCategory = "Jan" });
barSeries.Add(new DataPoint() { YValue = 48, XCategory = "Feb" });
barSeries.Add(new DataPoint() { YValue = 53, XCategory = "Mar" });
barSeries.Add(new DataPoint() { YValue = 41, XCategory = "Apr" });
barSeries.Add(new DataPoint() { YValue = 32, XCategory = "May" });
barSeries.Add(new DataPoint() { YValue = 28, XCategory = "Jun" });
barSeries.Add(new DataPoint() { YValue = 63, XCategory = "Jul" });
barSeries.Add(new DataPoint() { YValue = 74, XCategory = "Aug" });
barSeries.Add(new DataPoint() { YValue = 77, XCategory = "Sep" });
barSeries.Add(new DataPoint() { YValue = 85, XCategory = "Oct" });
barSeries.Add(new DataPoint() { YValue = 89, XCategory = "Nov" });
barSeries.Add(new DataPoint() { YValue = 80, XCategory = "Dec" });
telerikChart.DefaultView.ChartArea.DataSeries.Add(barSeries);
}
示例14: reconstructGraph
private void reconstructGraph()
{
// graph
//We need one data series for each chart series
DataSeries<int, double> cc1 = new DataSeries<int, double>(cc1legend);
DataSeries<int, double> cc2 = new DataSeries<int, double>(cc2legend);
DataSeries<int, double> cc3 = new DataSeries<int, double>(cc3legend);
String MyDocs = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
String ProjectLocation = "Visual Studio 2010\\Projects\\Kinect-Tracking-Project\\MatlabPrototypes\\FeatureDetection";
StreamReader FileStreamReader;
FileStreamReader = File.OpenText(System.IO.Path.Combine(MyDocs, ProjectLocation) + "\\results.csv");
int i = 1;
while (FileStreamReader.Peek() != -1)
{
string[] words;
words = FileStreamReader.ReadLine().Split(',');
double test = double.Parse(words[0]);
if (test == -1)
{
continue;
}
double cc1v = test;
double cc2v = double.Parse(words[1]);
double cc3v = double.Parse(words[2]);
if (cc1v == 0)
{
cc1v = 0.05;
}
if (cc2v == 0)
{
cc2v = 0.05;
}
if (cc3v == 0)
{
cc3v = 0.05;
}
cc1.Add(new DataPoint<int, double>() { X = i, Y = cc1v });
cc2.Add(new DataPoint<int, double>() { X = i, Y = cc2v });
cc3.Add(new DataPoint<int, double>() { X = i, Y = cc3v });
i = i + 1;
}
FileStreamReader.Close();
//Finally, associate the data series with the chart series
userchart.Series[0].DataSeries = cc1;
userchart.Series[1].DataSeries = cc2;
userchart.Series[2].DataSeries = cc3;
}
示例15: Data
private void Data()
{
DataSeries series = new DataSeries();
series.Definition = new HorizontalBarSeriesDefinition();
radChart.Width = 600;
radChart.Height = 300;
for (int i = 1; i < 8; i++)
{
series.Add(new DataPoint(i, i * i));
}
radChart.DefaultView.ChartArea.DataSeries.Add(series);
}