本文整理汇总了C#中Visifire.Charts.DataSeries类的典型用法代码示例。如果您正苦于以下问题:C# DataSeries类的具体用法?C# DataSeries怎么用?C# DataSeries使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataSeries类属于Visifire.Charts命名空间,在下文中一共展示了DataSeries类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestDateTimeWithTwoDataPoints
public void TestDateTimeWithTwoDataPoints()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Random rand = new Random();
DataSeries dataSeries = new DataSeries();
dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 1), YValue = rand.Next(10, 100) });
dataSeries.DataPoints.Add(new DataPoint() { XValue = new DateTime(2009, 1, 2), YValue = rand.Next(10, 100) });
chart.Series.Add(dataSeries);
Window window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
Assert.AreEqual(2, chart.Series[0].DataPoints.Count);
window.Dispatcher.InvokeShutdown();
window.Close();
}
}
示例2: CreateChart
public Chart CreateChart(ChartInformation ci)
{
Chart m_chart = new Chart();
m_chart.BorderThickness = ci.m_BorderThickness;
m_chart.Theme = ci.m_Theme;
m_chart.View3D = ci.m_View3D;
Axis m_axisX = new Axis();
m_axisX.Title = ci.m_axisXTitle;
m_chart.AxesX.Add(m_axisX);
Axis m_asixY = new Axis();
m_asixY.Title = ci.m_axisYTitle;
m_asixY.Enabled = true;
m_asixY.StartFromZero = true;
m_asixY.AxisType = AxisTypes.Primary;
m_asixY.AxisMaximum = ci.m_axisYMaximum;
m_asixY.Interval = ci.m_axisYInterval;
m_chart.AxesY.Add(m_asixY);
for(int i = 0;i<ci.dsc.Count;i++)
{
DataSeries ds = new DataSeries();
ds.LegendText = ci.dsc[i].LegendText;
ds.RenderAs = ci.dsc[i].RenderAs;
ds.AxisYType = ci.dsc[i].AxisYType;
ds.DataPoints = new DataPointCollection(ci.dsc[i].DataPoints);
m_chart.Series.Add(ds);
}
m_chart.Rendered+=new EventHandler(chart_Rendered);
return m_chart;
}
示例3: TestDateTimeWithSingleDataPoint
public void TestDateTimeWithSingleDataPoint()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Random rand = new Random();
TestPanel.Children.Add(chart);
EnqueueConditional(() => { return _isLoaded; });
EnqueueDelay(_sleepTime);
EnqueueCallback(() =>
{
DataSeries dataSeries = new DataSeries();
DataPoint dataPoint = new DataPoint();
dataPoint.XValue = new DateTime(2009, 1, 1);
dataPoint.YValue = rand.Next(10, 100);
dataSeries.DataPoints.Add(dataPoint);
chart.Series.Add(dataSeries);
});
EnqueueCallback(() =>
{
Assert.AreEqual(1, chart.Series[0].DataPoints.Count);
});
EnqueueDelay(_sleepTime);
EnqueueTestComplete();
}
示例4: button_Click
/// <summary>
/// Regresh chart
/// </summary>
private void button_Click(object sender, RoutedEventArgs e)
{
chart.Series.Clear();
// Create series for each matrix size
for (int size = 10; size <= 30; size += 5)
{
// Prepare series
DataSeries series = new DataSeries();
series.RenderAs = RenderAs.Line;
series.ShowInLegend = true;
series.LegendText = size.ToString();
series.LineThickness = 2;
// Get total count of cells in square matrix
int cellCount = size * size;
// Fill matrix with different percent of "zero" cells (from 1% to 100%)
for (double arcPercent = 0.01; arcPercent <= 1; arcPercent += percentStep)
{
// Calculate statistics of conflicts for all experiments
double conflicts = 0;
for (int experiment = 0; experiment < experiments; experiment++)
if (Matrix.HasConflict(Matrix.RandomMatrix(size, (int)(arcPercent * cellCount))))
conflicts++;
// Plot point (add to series)
DataPoint point = new DataPoint();
point.XValue = arcPercent * 100;
point.YValue = conflicts / experiments;
series.DataPoints.Add(point);
}
chart.Series.Add(series);
}
}
示例5: ImportLineData
public void ImportLineData(ArrayList values1, ArrayList values2)
{
dsc = new DataSeriesCollection();
DataSeries ds1 = new DataSeries();
ds1.RenderAs = RenderAs.Line;
ds1.LegendText = "ObjValue";
for (int i = 0; i < values1.Count; i = i + 4)
{
DataPoint dp = new DataPoint();
dp.YValue = (double)values1[i];
dp.XValue = i;
ds1.DataPoints.Add(dp);
}
DataSeries ds2 = new DataSeries();
ds2.RenderAs = RenderAs.Line;
ds2.LegendText = "Variance";
for (int i = 0; i < values2.Count; i = i + 4)
{
DataPoint dp = new DataPoint();
dp.YValue = (double)values2[i];
dp.XValue = i;
ds2.DataPoints.Add(dp);
}
dsc.Add(ds1);
dsc.Add(ds2);
}
示例6: barGraph_Click
//柱状图
private void barGraph_Click(object sender, RoutedEventArgs e)
{
graphContainer.Children.Clear();
Chart chart = new Chart();
chart.Watermark = false;
chart.View3D = true;
chart.Width = 300;
chart.Height = 200;
Title title = new Title();
title.Text = "人口类别统计图";
chart.Titles.Add(title);
for (int i = 0; i < 8; i++)
{
DataSeries dataSeries = new DataSeries();
dataSeries.ShowInLegend = false;
dataSeries.RenderAs = RenderAs.Column;
for (int loopIndex = 0; loopIndex < 3; loopIndex++)
{
DataPoint dataPoint = new DataPoint();
dataPoint.AxisXLabel = pop[loopIndex];
dataPoint.YValue = points[i, loopIndex];
dataSeries.DataPoints.Add(dataPoint);
}
chart.Series.Add(dataSeries);
}
//将柱状图添加到 Grid 控件以固定位置
graphContainer.VerticalAlignment = VerticalAlignment.Top;
graphContainer.HorizontalAlignment = HorizontalAlignment.Left;
graphContainer.Children.Add(chart);
}
示例7: AddDataToDataSerise
public static void AddDataToDataSerise(DataSeries ds,List<double> list)
{
double allCount = 100;
double value = allCount / list.Count;
for (int i = 0; i < list.Count; i++)
{
DataPoint dp = new DataPoint() { YValue = System.Math.Abs(list[i]) * 0.1, XValue = i * value };
ds.DataPoints.Add(dp);
}
}
示例8: CreatePolarSeries
/// <summary>
/// Create Polar series
/// </summary>
/// <param name="chart"></param>
/// <param name="series"></param>
/// <param name="polarCanvas"></param>
/// <param name="labelCanvas"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="plotGroup"></param>
/// <param name="circularPlotDetails"></param>
private static void CreatePolarSeries(Chart chart, DataSeries series, Canvas polarCanvas, Canvas labelCanvas, Double width, Double height, PlotGroup plotGroup, CircularPlotDetails circularPlotDetails)
{
List<List<DataPoint>> brokenLineDataPointsGroup = GetBrokenLineDataPointsGroup(series, circularPlotDetails, plotGroup);
foreach (List<DataPoint> dataPointList in brokenLineDataPointsGroup)
{
foreach (DataPoint dataPoint in dataPointList)
DrawMarker(dataPoint, labelCanvas, width, height, circularPlotDetails.Center);
DrawDataSeriesPath(series, dataPointList, polarCanvas);
}
}
示例9: LoadPriceChart
/// <summary>
/// Show chart with data series
/// </summary>
/// <param name="dataSeries"></param>
public void LoadPriceChart(TradeRobotics.Model.StockDataSeries dataSeries)
{
//List<Bar> bars = dataSeries.Bars;
Visifire.Charts.DataSeries ds = new DataSeries();
ds.RenderAs = RenderAs.CandleStick;
ds.MarkerEnabled = true;
ds.MovingMarkerEnabled = true;
ds.LightingEnabled = true;
ds.LineThickness = 1.5;
//ds.XValueType = ChartValueTypes.DateTime;
ds.LegendText = string.Concat(dataSeries.Symbol, " ", dataSeries.Period);
ds.PriceUpColor = new SolidColorBrush(Colors.Green);
ds.PriceDownColor = new SolidColorBrush(Colors.Red);
//PriceChart.AxesY[0].AxisMinimum = bars.Min(bar => bar.Low);
//PriceChart.AxesY[0].AxisMaximum = bars.Max(bar => bar.High);
PriceChart.AxesY[0].StartFromZero = false;
PriceChart.AxesY[0].ViewportRangeEnabled = true;
if (dataSeries.Bars.Count > 0)
{
// Add points
//for (int i = 0; i < dataSeries.Count; i++)
foreach (Bar bar in dataSeries.Bars)
{
ds.DataPoints.Add(new DataPoint
{
AxisXLabel = bar.Time.ToString("yyyy-MM-dd HH:mm"),
//ToolTipText = "aa\nbb",
//XValue = bar.Time, // a DateTime value
YValues = new double[] { bar.Open, bar.Close, bar.High, bar.Low }
//dataSeries.Close[i], dataSeries.High[i], dataSeries.Low[i] } // a double value
});
}
}
else
{
foreach (Quote quote in dataSeries.Quotes)
{
ds.DataPoints.Add(new DataPoint
{
AxisXLabel = quote.Time.ToString("yyyy-MM-dd HH:mm"),
//ToolTipText = "aa\nbb",
//XValue = bar.Time, // a DateTime value
YValues = new double[] { quote.Price, quote.Price, quote.Price, quote.Price }
//dataSeries.Close[i], dataSeries.High[i], dataSeries.Low[i] } // a double value
});
}
}
PriceChart.Series.Add(ds);
PriceChart.ZoomingEnabled = true;
}
示例10: ColumnChartPerformanceTest
public void ColumnChartPerformanceTest()
{
Double totalDuration = 0;
DateTime start = DateTime.UtcNow;
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
chart.View3D = false;
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Axis axisX = new Axis();
axisX.Interval = 1;
chart.AxesX.Add(axisX);
Random rand = new Random();
Int32 numberOfSeries = 0;
DataSeries dataSeries = null;
Int32 numberofDataPoint = 0;
String msg = Common.AssertAverageDuration(100, 1, delegate
{
dataSeries = new DataSeries();
dataSeries.RenderAs = RenderAs.Column;
for (Int32 i = 0; i < 1000; i++)
{
DataPoint dataPoint = new DataPoint();
dataPoint.AxisXLabel = "a" + i;
dataPoint.YValue = rand.Next(-100, 100);
dataSeries.DataPoints.Add(dataPoint);
numberofDataPoint++;
}
numberOfSeries++;
chart.Series.Add(dataSeries);
});
window = new Window();
window.Content = chart;
window.Show();
if (_isLoaded)
{
DateTime end = DateTime.UtcNow;
totalDuration = (end - start).TotalSeconds;
MessageBox.Show("Total Chart Loading Time: " + totalDuration + "s" + "\n" + "Number of Render Count: " + chart.ChartArea._renderCount + "\n" + "Series Calculation: " + msg);
}
window.Dispatcher.InvokeShutdown();
}
示例11: InitializeComponent
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Windows.Application.LoadComponent(this, new System.Uri("/Map;component/Chart1.xaml", System.UriKind.Relative));
this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
this.Chart = ((Visifire.Charts.Chart)(this.FindName("Chart")));
this.DataSeries = ((Visifire.Charts.DataSeries)(this.FindName("DataSeries")));
this.tb = ((System.Windows.Controls.TextBox)(this.FindName("tb")));
this.MyGrid = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("MyGrid")));
}
示例12: Balance
public void Balance(int earning, int expense)
{
var chart = new Chart {Width = 500, Height = 300, View3D = true};
chart.Titles.Add(new Title {Text = "Cân bằng tài chính"});
var dataSeries = new DataSeries {RenderAs = RenderAs.Column};
dataSeries.DataPoints.Add(new DataPoint {YValue = earning, AxisXLabel = "Tổng thu nhập"});
dataSeries.DataPoints.Add(new DataPoint {YValue = expense, AxisXLabel = "Tổng chi tiêu"});
chart.Series.Add(dataSeries);
LayoutRoot.Children.Clear();
LayoutRoot.Children.Add(chart);
}
示例13: TestDataPointPropertyChanged
public void TestDataPointPropertyChanged()
{
Chart chart = new Chart();
chart.Width = 500;
chart.Height = 300;
_isLoaded = false;
chart.Loaded += new RoutedEventHandler(chart_Loaded);
Random rand = new Random();
TestPanel.Children.Add(chart);
EnqueueConditional(() => { return _isLoaded; });
EnqueueDelay(_sleepTime);
DataSeries dataSeries = new DataSeries();
DataPoint dataPoint = null;
for (Int32 i = 0; i < 10; i++)
{
dataPoint = new DataPoint();
dataPoint.XValue = i + 1;
dataPoint.YValue = rand.Next(10, 100);
dataPoint.PropertyChanged += delegate(Object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
Assert.IsNotNull(e.PropertyName);
if (e.PropertyName == "XValue")
Assert.AreEqual("XValue", e.PropertyName);
else if (e.PropertyName == "YValue")
Assert.AreEqual("YValue", e.PropertyName);
else
Assert.IsNotNull(e.PropertyName);
};
dataSeries.DataPoints.Add(dataPoint);
}
chart.Series.Add(dataSeries);
EnqueueCallback(() =>
{
dataPoint.XValue = 10;
dataPoint.YValue = rand.Next(-100, 100);
});
EnqueueDelay(_sleepTime);
EnqueueTestComplete();
}
示例14: SetChartData
private void SetChartData(DataTable dt,string strname, string linecolor)
{
Visifire.Charts.DataSeries dataSeries = new Visifire.Charts.DataSeries();
AddDataSeries(strname, dataSeries, LineStyles.Solid, new SolidColorBrush((Color)ColorConverter.ConvertFromString(linecolor)), Visifire.Charts.RenderAs.QuickLine);
for (int i = 0; i < dt.Rows.Count; i++)
{
Visifire.Charts.DataPoint dataPoint = new DataPoint();
dataPoint.AxisXLabel = dt.Rows[i]["time"].ToString();
dataPoint.Color = new SolidColorBrush(Colors.Blue);
dataPoint.YValue = Convert.ToDouble(dt.Rows[i]["value"]);
dataPoint.Tag = " ";
dataSeries.DataPoints.Add(dataPoint);
}
this.chartC.Series.Add(dataSeries);
}
示例15: AddSeries
private void AddSeries(Chart c, List<double> list,bool showInLengend,string lengendText)
{
DataSeries ds = new DataSeries();
ds.ShowInLegend = showInLengend;
ds.RenderAs = RenderAs.QuickLine;
if (showInLengend) {
ds.Color = avgBrush;
ds.LegendText = lengendText;
}
for (int i = 0; i < list.Count; i++)
{
DataPoint dp = new DataPoint() { YValue = Math.Abs(list[i]) };
ds.DataPoints.Add(dp);
}
c.Series.Add(ds);
}