本文整理汇总了C#中SeriesCollection类的典型用法代码示例。如果您正苦于以下问题:C# SeriesCollection类的具体用法?C# SeriesCollection怎么用?C# SeriesCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SeriesCollection类属于命名空间,在下文中一共展示了SeriesCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BasicLine
public BasicLine()
{
InitializeComponent();
//we create a new SeriesCollection
Series = new SeriesCollection();
//create some LineSeries
var charlesSeries = new LineSeries
{
Title = "Charles",
Values = new ChartValues<double> {10, 5, 7, 5, 7, 8}
};
var jamesSeries = new LineSeries
{
Title = "James",
Values = new ChartValues<double> { 5, 6, 9, 10, 11, 9 }
};
//add our series to our SeriesCollection
Series.Add(charlesSeries);
Series.Add(jamesSeries);
//that's it, LiveCharts is ready and listening for your data changes.
DataContext = this;
}
开发者ID:g1ga,项目名称:Live-Charts,代码行数:27,代码来源:BasicLine.xaml.cs
示例2: ComboHorizontal
public static void ComboHorizontal(dotnetCHARTING.Chart chart, int width, int height, string title, DataTable table, string xColumn, string yColumn)
{
SeriesCollection SC = new SeriesCollection();
Series s = new Series();
foreach (DataRow row in table.Rows)
{
string telType = row[xColumn].ToString();
Element e = new Element();
e.Name = telType;
e.LabelTemplate = "%PercentOfTotal";
e.YValue = Convert.ToDouble(row[yColumn].ToString());
s.Elements.Add(e);
}
SC.Add(s);
chart.TempDirectory = "temp";
chart.Use3D = false;
chart.DefaultAxis.Interval = 10;
chart.DefaultAxis.CultureName = "zh-CN";
chart.Palette = new Color[] { Color.FromArgb(49, 255, 49), Color.FromArgb(255, 255, 0), Color.FromArgb(255, 99, 49), Color.FromArgb(0, 156, 255) };
chart.DefaultElement.SmartLabel.AutoWrap = true;
chart.Type = ChartType.ComboHorizontal;
chart.Size = width + "x" + height;
chart.DefaultElement.SmartLabel.Text = "";
chart.Title = title;
chart.DefaultElement.ShowValue = true;
chart.PieLabelMode = PieLabelMode.Outside;
chart.ShadingEffectMode = ShadingEffectMode.Three;
chart.NoDataLabel.Text = "û��������ʾ";
chart.SeriesCollection.Add(SC);
}
开发者ID:wengyuli,项目名称:ecsms,代码行数:30,代码来源:ChartHelper.cs
示例3: RotatedStackedBar
public RotatedStackedBar()
{
InitializeComponent();
var config = new SeriesConfiguration<double>().X(val => val);
SeriesCollection = new SeriesCollection(config)
{
new StackedBarSeries
{
Title = "Stacked Serie 1",
Values = new double[] {3,6,2,7}.AsChartValues(),
DataLabels = true
},
new StackedBarSeries
{
Title = "Stacked Serie 1",
Values = new double[] {6,3,5,2}.AsChartValues(),
DataLabels = true
},
new LineSeries
{
Title = "Line Series",
Values = new double[] {10, 11, 8, 9}.AsChartValues(),
Fill = Brushes.Transparent
}
};
DataContext = this;
}
开发者ID:Beanium,项目名称:Live-Charts,代码行数:30,代码来源:RotatedStackedBar.xaml.cs
示例4: InitializeBarGraph
private static Chart InitializeBarGraph(SeriesCollection seriesCollection, string yAxisTitle)
{
var chart = new Chart();
//chart.Title = "Burndown";
chart.Type = ChartType.Combo;
chart.TempDirectory = VirtualPathUtility.ToAbsolute("~/file/chart");
chart.SeriesCollection.Add(seriesCollection);
chart.YAxis.Label.Text = yAxisTitle;
chart.YAxis.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
chart.YAxis.DefaultTick.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
chart.XAxis.DefaultTick.Label.Color = System.Drawing.ColorTranslator.FromHtml("#CCCCCC");
chart.LegendBox.Visible = false;
chart.BorderStyle = System.Web.UI.WebControls.BorderStyle.None;
chart.TitleBox.Visible = false;
chart.Background.Color = System.Drawing.ColorTranslator.FromHtml("#333333");
chart.DefaultSeries.Element.Color = System.Drawing.ColorTranslator.FromHtml("#1B12A6");
chart.DefaultElement.Color = System.Drawing.ColorTranslator.FromHtml("#1B12A6");
chart.Width = new System.Web.UI.WebControls.Unit(600, System.Web.UI.WebControls.UnitType.Pixel);
chart.Height = new System.Web.UI.WebControls.Unit(400, System.Web.UI.WebControls.UnitType.Pixel);
chart.Font.Name = "Helvetica";
chart.Font.Size = new System.Web.UI.WebControls.FontUnit(24, System.Web.UI.WebControls.UnitType.Pixel);
chart.YAxis.Label.Font = new System.Drawing.Font("Helvetica", 8);
chart.YAxis.DefaultTick.Label.Font = new System.Drawing.Font("Helvetica", 8);
chart.XAxis.DefaultTick.Label.Font = new System.Drawing.Font("Helvetica", 8);
//NOTE: needed to do this for the old version of .net charting (3.4).
chart.FileManager.TempDirectory = VirtualPathUtility.ToAbsolute("~/file/chart");
chart.FileManager.SaveImage(chart.GetChartBitmap());
//chart.FileManager.FileName = chart.FileManager.TempDirectory + "/" + chart.FileManager.FileName + ".png";
return chart;
}
开发者ID:rkurz,项目名称:Cerebro,代码行数:32,代码来源:ChartService.cs
示例5: BasicLineExample
public BasicLineExample()
{
InitializeComponent();
SeriesCollection = new SeriesCollection
{
new LineSeries
{
Title = "Series 1",
Values = new ChartValues<double> { 4, 6, 5, 2 ,7 }
},
new LineSeries
{
Title = "Series 2",
Values = new ChartValues<double> { 6, 7, 3, 4 ,6 }
}
};
Labels = new[] {"Jan", "Feb", "Mar", "Apr", "May"};
YFormatter = value => value.ToString("C");
//modifying the series collection will animate and update the chart
SeriesCollection.Add(new LineSeries
{
Values = new ChartValues<double> {5, 3, 2, 4},
LineSmoothness = 0 //straight lines, 1 really smooth lines
});
//modifying any series values will also animate and update the chart
SeriesCollection[2].Values.Add(5d);
DataContext = this;
}
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:33,代码来源:BasicLineExample.xaml.cs
示例6: MissingPointsExample
public MissingPointsExample()
{
InitializeComponent();
Series = new SeriesCollection
{
new LineSeries
{
Values = new ChartValues<double>
{
4,
5,
7,
8,
double.NaN,
5,
2,
8,
double.NaN,
6,
2
}
}
};
DataContext = this;
}
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:27,代码来源:MissingPointsExample.xaml.cs
示例7: FetchAll
public SeriesCollection FetchAll()
{
var coll = new SeriesCollection();
var qry = new Query(Series.Schema);
coll.LoadAndCloseReader(qry.ExecuteReader());
return coll;
}
开发者ID:khaha2210,项目名称:radio,代码行数:7,代码来源:SeriesController.cs
示例8: LogarithmicAxis
public LogarithmicAxis()
{
InitializeComponent();
//we create a configuration to map our values type, in this case System.Windows.Point
var config = new SeriesConfiguration<Point>()
.X(point => Math.Log(point.X, 10)) // we use log10(point.X) as X
.Y(point => point.Y); // we use point.Y as the Y of our chart (amm.... yes, we are so f* smart!)
//we pass the config to the SeriesCollection constructor, or you can use Series.Setup(config)
Series = new SeriesCollection(config)
{
new LineSeries
{
Values = new ChartValues<Point>
{
new Point(1, 10),
new Point(10, 15),
new Point(100, 29),
new Point(1000, 38),
new Point(10000, 45),
new Point(100000, 55)
}
}
};
//to display labels we convert back from log
//this is just the inverse operation
XFormatter = x =>
{
return Math.Pow(10, x).ToString();
};
DataContext = this;
}
开发者ID:IGNATIUSLIJO,项目名称:Live-Charts,代码行数:35,代码来源:LogarithmicAxis.xaml.cs
示例9: RotatedBar
public RotatedBar()
{
InitializeComponent();
var config = new SeriesConfiguration<double>().X(value => value);
SeriesCollection =
new SeriesCollection(config)
{
new BarSeries
{
Title = "inverted series",
Values = new double[] {10, 15, 18, 20, 15, 13}.AsChartValues(),
DataLabels = true
},
new BarSeries
{
Title = "inverted series 2",
Values = new double[] {4, 8, 19, 19, 16, 12}.AsChartValues(),
DataLabels = true
},
new LineSeries
{
Title = "inverted line series",
Values = new double[] {10, 15, 18, 20, 15, 13}.AsChartValues(),
Fill = Brushes.Transparent
}
};
DataContext = this;
}
开发者ID:g1ga,项目名称:Live-Charts,代码行数:31,代码来源:RotatedBar.xaml.cs
示例10: ZoomingAndPanning
public ZoomingAndPanning()
{
InitializeComponent();
var gradientBrush = new LinearGradientBrush {StartPoint = new Point(0, 0),
EndPoint = new Point(0, 1)};
gradientBrush.GradientStops.Add(new GradientStop(Color.FromRgb(33, 148, 241), 0));
gradientBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1));
SeriesCollection = new SeriesCollection
{
new LineSeries
{
Values = GetData(),
Fill = gradientBrush,
StrokeThickness = 1,
PointGeometrySize = 0
}
};
ZoomingMode = ZoomingOptions.X;
XFormatter = val => new DateTime((long) val).ToString("dd MMM");
YFormatter = val => val.ToString("C");
DataContext = this;
}
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:27,代码来源:ZoomingAndPanning.xaml.cs
示例11: FilterChart
public FilterChart()
{
InitializeComponent();
//create a configuration for City class
var config = new SeriesConfiguration<City>()
.Y(city => city.Population); // use Population an Y
// X will use default config, a zero based index
//create a series collection with this config
Series = new SeriesCollection(config);
//lets pull some initials results
var results = DataBase.Cities.OrderByDescending(city => city.Population).Take(15).ToArray();
PopulationSeries = new BarSeries
{
Title = "Population by city 2015",
Values = results.AsChartValues(),
DataLabels = true
};
//there are 2 types of labels, when we use a formatter, and a strong array mapping
//in this case instead of a label formatter we use a strong array labels
//since X is a zero based index LiveCharts automatically maps this array with X
//so when X = 0 label will be labels[0], when X = 1 labels[1], X = 2 labels[2], X = n labels[n]
Labels = results.Select(city => city.Name).ToArray();
Series.Add(PopulationSeries);
DataContext = this;
}
开发者ID:Beanium,项目名称:Live-Charts,代码行数:32,代码来源:FilterChart.xaml.cs
示例12: IrregularLine
public IrregularLine()
{
InitializeComponent();
//we create a configuration to map our values type, in this case System.Windows.Point
var config = new SeriesConfiguration<Point>()
.X(point => point.X) // we use point.X as the X of our chart (you don't say!)
.Y(point => point.Y); // we use point.Y as the Y of our chart -.-"
//we pass the config to the SeriesCollection constructor, or you can use Series.Setup(config)
Series = new SeriesCollection(config)
{
new LineSeries
{
Values = new ChartValues<Point>
{
new Point(1, 10),
new Point(2, 15),
new Point(4, 29),
new Point(8, 38),
new Point(16, 45),
new Point(32, 55),
new Point(64, 62),
new Point(128, 76),
new Point(256, 95)
},
Fill = Brushes.Transparent
}
};
DataContext = this;
}
开发者ID:g1ga,项目名称:Live-Charts,代码行数:32,代码来源:IrregularLine.xaml.cs
示例13: SalesViewModel
public SalesViewModel()
{
var config = new SeriesConfiguration<SalesData>().Y(data => data.ItemsSold);
Salesmen = new SeriesCollection(config)
{
new PieSeries
{
Title = "Charles",
Values = new ChartValues<SalesData>
{
new SalesData {ItemsSold = 15, Rentability = .15, ItemsAverageSellPrice = 5000}
}
},
new PieSeries
{
Title = "Frida",
Values = new ChartValues<SalesData>
{
new SalesData {ItemsSold = 16, Rentability = .12, ItemsAverageSellPrice = 5200}
}
},
new PieSeries
{
Title = "George",
Values = new ChartValues<SalesData>
{
new SalesData {ItemsSold = 22, Rentability = .11, ItemsAverageSellPrice = 5100}
}
}
};
}
开发者ID:g1ga,项目名称:Live-Charts,代码行数:31,代码来源:MvvmPie.xaml.cs
示例14: DynamicLine
public DynamicLine()
{
InitializeComponent();
//In this case we will not only plot double values
//to make it easier to handle "live-data" we are going to use WeatherViewModel class
//we need to let LiveCharts know how to use this model
//first we create a new configuration for WeatherViewModel
var config = new SeriesConfiguration<WeatherViewModel>();
//now we map X and Y
//we will use Temperature as Y
config.Y(model => model.Temperature);
//and DateTime as X, we convert to OADate so we can plot it easly.
config.X(model => model.DateTime.ToOADate());
//now we create our series with this configuration
Series = new SeriesCollection(config) {new LineSeries {Values = new ChartValues<WeatherViewModel>()}};
//to display a custom label we will use a formatter,
//formatters are just functions that take a double value as parameter
//and return a string, in this case we will convert the OADate to DateTime
//and then use a custom date format
XFormatter = val => DateTime.FromOADate(val).ToString("hh:mm:ss tt");
//now for Y we are rounding and adding ° for degrees
YFormatter = val => Math.Round(val) + " °";
//Don't forget DataContext so we can bind these properties.
DataContext = this;
_timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };
_timer.Tick += TimerOnTick;
}
开发者ID:Beanium,项目名称:Live-Charts,代码行数:34,代码来源:DynamicLine.xaml.cs
示例15: StackedColumnExample
public StackedColumnExample()
{
InitializeComponent();
SeriesCollection = new SeriesCollection
{
new StackedColumnSeries
{
Values = new ChartValues<ObservableValue>
{
new ObservableValue(5),
new ObservableValue(8),
new ObservableValue(2),
new ObservableValue(4),
new ObservableValue(6),
new ObservableValue(2),
new ObservableValue(9),
new ObservableValue(3)
},
DataLabels = true
},
new StackedColumnSeries
{
Values = new ChartValues<ObservableValue>
{
new ObservableValue(7),
new ObservableValue(4),
new ObservableValue(1),
new ObservableValue(7),
new ObservableValue(2),
new ObservableValue(7),
new ObservableValue(0),
new ObservableValue(3)
},
DataLabels = true
},
new StackedColumnSeries
{
Values = new ChartValues<ObservableValue>
{
new ObservableValue(6),
new ObservableValue(2),
new ObservableValue(8),
new ObservableValue(2),
new ObservableValue(9),
new ObservableValue(2),
new ObservableValue(3),
new ObservableValue(3)
},
DataLabels = true
}
};
Labels = new[]
{
"Jan", "Feb","Mar", "Apr", "May", "Jun", "Jul", "Ago"
};
DataContext = this;
}
开发者ID:Chandu-cuddle,项目名称:Live-Charts,代码行数:60,代码来源:StackedColumnExample.xaml.cs
示例16: SensorEnumerator
public SensorEnumerator(SeriesCollection collection)
{
foreach (Series s in collection)
{
dataEnums.Add(s.Points.GetEnumerator());
}
}
开发者ID:graceyha,项目名称:gcc-quadrocopter,代码行数:7,代码来源:SensorEnumerator.cs
示例17: LogarithmScaleExample
public LogarithmScaleExample()
{
InitializeComponent();
SeriesCollection = new SeriesCollection(Mappers.Xy<ObservablePoint>()
.X(point => Math.Log10(point.X))
.Y(point => point.Y))
{
new LineSeries
{
Values = new ChartValues<ObservablePoint>
{
new ObservablePoint(1, 5),
new ObservablePoint(10, 6),
new ObservablePoint(100, 4),
new ObservablePoint(1000, 2),
new ObservablePoint(10000, 8),
new ObservablePoint(100000, 2),
new ObservablePoint(1000000, 9),
new ObservablePoint(10000000, 8)
}
}
};
Formatter = value => Math.Pow(10, value).ToString("N");
DataContext = this;
}
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:28,代码来源:LogarithmScaleExample.xaml.cs
示例18: Statistic
public Statistic(int episodeCount, double meanScore, SeriesCollection scoreDistribution, string[] scoreRatings, int serieCount)
{
EpisodeCount = episodeCount;
MeanScore = meanScore;
ScoreDistribution = scoreDistribution;
SerieCount = serieCount;
ScoreRatings = scoreRatings;
}
开发者ID:dreanor,项目名称:StreamCompanion,代码行数:8,代码来源:Statistic.cs
示例19: DateTime
public DateTime()
{
InitializeComponent();
var dayConfig = Mappers.Xy<DateModel>()
.X(dayModel => (double) dayModel.DateTime.Ticks/TimeSpan.FromHours(1).Ticks)
.Y(dayModel => dayModel.Value);
//Notice you can also configure this type globally, so you don't need to configure every
//SeriesCollection instance using the type.
//more info at http://lvcharts.net/App/Index#/examples/v1/wpf/Types%20and%20Configuration
Series = new SeriesCollection(dayConfig)
{
new LineSeries
{
Values = new ChartValues<DateModel>
{
new DateModel
{
DateTime = System.DateTime.Now,
Value = 5
},
new DateModel
{
DateTime = System.DateTime.Now.AddHours(2),
Value = 9
}
},
Fill = Brushes.Transparent
},
new ColumnSeries
{
Values = new ChartValues<DateModel>
{
new DateModel
{
DateTime = System.DateTime.Now,
Value = 4
},
new DateModel
{
DateTime = System.DateTime.Now.AddHours(1),
Value = 6
},
new DateModel
{
DateTime = System.DateTime.Now.AddHours(2),
Value = 8
}
}
}
};
Formatter = value => new System.DateTime((long) (value*TimeSpan.FromHours(1).Ticks)).ToString("t");
DataContext = this;
}
开发者ID:beto-rodriguez,项目名称:Live-Charts,代码行数:58,代码来源:DateTime.xaml.cs
示例20: Chart
public Chart(List<DateTime> dateList,List<int> dataList,string xTitle,string yTitle)
{
InitializeComponent();
YTitle = yTitle;
XTitle = xTitle;
date = dateList;
data = dataList;
if (date.Count == 0)
return;
if(date.Count==1)
{
date.Add(date[0]);
DateTime prev = date[0].AddDays(-1);
date[0]=prev;
data.Add(data[0]);
}
if(date.Count>0 && date.Count<step)
{
From = date[0].Date.AddYears(1899).AddDays(-1).ToOADate();
To = date[date.Count-1].Date.AddYears(1899).AddDays(-1).ToOADate();
}
if (date.Count >= step)
{
To = date[date.Count - 1].Date.AddYears(1899).AddDays(-1).ToOADate(); //установка границ отрисовки графика
From = (To-step);
}
left= date[0].Date.AddYears(1899).AddDays(-1).ToOADate();
right= date[date.Count - 1].Date.AddYears(1899).AddDays(-1).ToOADate();
SetYScale();
var dayConfig = Mappers.Xy<DateModel>()
.X(dateModel => dateModel.DateTime.Ticks / TimeSpan.FromDays(1).Ticks)
.Y(dateModel => dateModel.Value); //распределение данных по осям
Series = new SeriesCollection(dayConfig)
{
new LineSeries //создание линии
{
Title=yTitle,
Values = GetData(date,data),
StrokeThickness = 1,
DataLabels=true,
}
};
res = To - From;
curStep = step;
Formatter = value => new DateTime((long)(value * TimeSpan.FromDays(1).Ticks)).ToString("dd MMM yyyy"); //форматирование оси x
DataContext = this;
}
开发者ID:yurijvolkov,项目名称:Statirys,代码行数:56,代码来源:Chart.xaml.cs
注:本文中的SeriesCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论