public CustomerCategorySalesChartView() { #region chart series PieSeries pieSeries = new PieSeries() { ExplodeAll = true, ConnectorLineType = ConnectorLineType.Bezier, DataMarkerPosition = CircularSeriesDataMarkerPosition.OutsideExtended, DataMarker = new ChartDataMarker() { LabelStyle = new DataMarkerLabelStyle() { Margin = new Thickness(5), LabelFormat = "$0.00" } }, ColorModel = new ChartColorModel() { Palette = ChartColorPalette.Custom, CustomBrushes = new List <Color>() { Palette._014, Palette._015, Palette._016 } } }; pieSeries.SetBinding(ChartSeries.ItemsSourceProperty, "CategorySalesChartDataPoints"); #endregion #region chart SfChart chart = new SfChart() { HeightRequest = ChartHeight, Legend = new ChartLegend() { DockPosition = LegendPlacement.Top }, //BackgroundColor = Color.Transparent }; chart.Legend.LabelStyle.TextColor = LegendLabelColor; chart.SetBinding(IsEnabledProperty, "IsBusy", converter: new InverseBooleanConverter()); chart.SetBinding(IsVisibleProperty, "IsBusy", converter: new InverseBooleanConverter()); chart.Series.Add(pieSeries); #endregion #region platform adjustments Device.OnPlatform( Android: () => { Font androidChartLabelFont = Font.SystemFontOfSize(Device.GetNamedSize(NamedSize.Large, typeof(Label)) * 1.5); pieSeries.DataMarker.LabelStyle.Font = androidChartLabelFont; }); #endregion Content = chart; }
public override PlotModel createChart() { PlotModel model = new PlotModel { Title = "Pie Sample1" }; var seriesP1 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 }; seriesP1.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = false, Fill = OxyColors.PaleVioletRed }); seriesP1.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true }); seriesP1.Slices.Add(new PieSlice("Asia", 4157) { IsExploded = true }); seriesP1.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true }); seriesP1.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true }); model.Series.Add(seriesP1); return(model); }
private void showChartSlowMoving() { Func <ChartPoint, string> labelPoint = chartPoint => string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation); SeriesCollection series = new SeriesCollection(); conn.Open(); MySqlCommand scom = conn.CreateCommand(); scom.CommandText = "SELECT product_name, SUM(quantity) AS 'quantity' FROM sales_report GROUP BY product_name ORDER BY quantity ASC LIMIT 5"; MySqlDataReader dr = scom.ExecuteReader(); while (dr.Read()) { PieSeries ps = new PieSeries { Title = dr["product_name"].ToString(), Values = new ChartValues <int> { Int32.Parse(dr["quantity"].ToString()) }, DataLabels = true, LabelPoint = labelPoint }; series.Add(ps); } conn.Close(); chartSlowMoving.Series = series; chartSlowMoving.LegendLocation = LegendLocation.Bottom; chartSlowMoving.AnimationsSpeed = TimeSpan.FromMilliseconds(2000); }
private void Button_Click_1(object sender, RoutedEventArgs e) { listArt = listaArticulos(8); /* SeriesCollection series = new SeriesCollection(); * foreach (var obj in listArt) * series.Add(new PieSeries() { Title = obj.ArticuloID, Values = new ChartValues<int> { obj.Cantidad.Value }, DataLabels = true, LabelPoint = label }); */ ChartValues <int> chartvalue = new ChartValues <int>(); SeriesCollection PieSeriesCollection2 = new SeriesCollection(); for (int i = 0; i < listArt.Count; i++) { chartvalue = new ChartValues <int>(); chartvalue.Add(listArt[i].Cantidad.Value); PieSeries series2 = new PieSeries(); series2.DataLabels = true; series2.Title = listArt[i].ArticuloID; series2.Values = chartvalue; PieSeriesCollection2.Add(series2); } pie.Series = PieSeriesCollection2; GetPieSeriesData(); GetColunmSeriesData(listArt); // pie.LegendLocation = LegendLocation.Right; DataContext = this; }
public BasicPieChart(IEnumerable source) { InitializeComponent(); if (source == null) { return; } var enumerable = source as Dictionary <string, List <DateTime> >; if (enumerable != null) { SeriesCollection = new SeriesCollection(); foreach (var item in enumerable) { var ser = new PieSeries { Title = item.Key, Values = new ChartValues <ObservableValue> { new ObservableValue(item.Value.Count) }, DataLabels = true, }; SeriesCollection.Add(ser); } } PointLabel = chartPoint => $"{chartPoint.Y} ({chartPoint.Participation:P})"; DataContext = this; }
public MyViewModel() { PieSeries pieSeries = new PieSeries(); pieSeries.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = false, Fill = OxyColors.PaleVioletRed }); pieSeries.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true }); pieSeries.Slices.Add(new PieSlice("Asia", 4157) { IsExploded = true }); pieSeries.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true }); pieSeries.Slices.Add(new PieSlice("Oceania", 350) { IsExploded = true }); MyModel = new PlotModel(); MyModel.Series.Add(pieSeries); }
public override View GetSampleContent(Context context) { var chart = new SfChart(context);; chart.SetBackgroundColor(Color.White); chart.Legend.Visibility = Visibility.Visible; var datas = new ObservableArrayList(); datas.Add(new ChartDataPoint("2010", 8000)); datas.Add(new ChartDataPoint("2011", 8100)); datas.Add(new ChartDataPoint("2012", 8250)); datas.Add(new ChartDataPoint("2013", 8600)); datas.Add(new ChartDataPoint("2014", 8700)); var pieSeries = new PieSeries { ExplodeIndex = 3, DataSource = datas, DataMarkerPosition = CircularSeriesDataMarkerPosition.OutsideExtended, }; pieSeries.DataMarker.ShowLabel = true; pieSeries.ConnectorType = ConnectorType.Bezier; chart.Series.Add(pieSeries); return chart; }
public void Build(double Width, double Height) { var GraphSize = new[] { Width, Height }.Min() * 0.6; Pie = new PieSeries { TextColor = OxyColors.White, StrokeThickness = 1.0, StartAngle = 270, AngleSpan = 360, Slices = MakeSlices(), }; GraphView = new PlotView { BackgroundColor = Color.White, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, WidthRequest = GraphSize, HeightRequest = GraphSize, Margin = new Thickness(24.0), Model = new OxyPlot.PlotModel { Series = { Pie, }, }, }; GrahpFrame = new Grid().HorizontalJustificate ( GraphView ); GrahpFrame.BackgroundColor = Color.White; GrahpFrame.VerticalOptions = LayoutOptions.FillAndExpand; }
private static IList <DataPoint> GetDataPoints(ChartSeries series) { PieSeries pieSeries = series as PieSeries; if (pieSeries != null) { return((IList <DataPoint>)pieSeries.DataPoints); } CategoricalSeries categoricalSeries = series as CategoricalSeries; if (categoricalSeries != null) { return(categoricalSeries.DataPoints); } RangeSeries rangeSeries = series as RangeSeries; if (rangeSeries != null) { return(rangeSeries.DataPoints); } OhlcSeries ohlcSeries = series as OhlcSeries; if (ohlcSeries != null) { return(ohlcSeries.DataPoints); } ScatterPointSeries scatterPointSeries = (ScatterPointSeries)series; return(scatterPointSeries.DataPoints); }
private static bool TryRunSweepAngleAnimtation(PieSeries series) { double sweepAngle = (double)series.GetAnimationBaseValue(ChartAnimationUtilities.SweepAngleProperty); if (double.IsNaN(sweepAngle)) { series.SetValue(ChartAnimationUtilities.SweepAngleProperty, series.AngleRange.SweepAngle); sweepAngle = series.AngleRange.SweepAngle; } DoubleAnimation animation = new DoubleAnimation(); animation.From = 0.0; animation.To = sweepAngle; animation.Duration = AnimationDuration; animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut, }; Storyboard.SetTargetProperty(animation, new PropertyPath(ChartAnimationUtilities.SweepAngleProperty)); Storyboard.SetTarget(animation, series); Storyboard storyboard = new Storyboard(); storyboard.Children.Add(animation); return(Run(storyboard, series)); }
//create Pie chart for expense usage private PlotModel CreatePlotModel(SQLiteConnection db, DateTime firstDayOfMonth, DateTime lastDayOfMonth) { PlotModel plotModel = new PlotModel { Title = "Expense Usage Ratio", TitleColor = OxyColors.White }; PieSeries seriesP1 = new PieSeries { StrokeThickness = 1.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0, TextColor = OxyColors.White }; lock (locker) { //get category that are used for this month var categoryList = (from s in db.Table <MoneyBook>() where (s.Date >= firstDayOfMonth && s.Date <= lastDayOfMonth && s.I_E == "E") select s).GroupBy(s => s.Category).Select(s => s.First()); //for each category, get sum of a category foreach (var cat in categoryList) { var sumCategory = (from s in db.Table <MoneyBook>() where (s.Date >= firstDayOfMonth && s.Date <= lastDayOfMonth && s.I_E == "E" && s.Category == cat.Category) select s).Sum(s => s.Amount); seriesP1.Slices.Add(new PieSlice(cat.Category, Convert.ToDouble(sumCategory)) { IsExploded = true }); } } plotModel.Series.Add(seriesP1); return(plotModel); }
/// <summary> /// Set a custom CategprySpreadingModel with the set Start and Enddate /// </summary> private PlotModel GetSpreadingModel() { var items = speadingDataProvider.GetValues(StartDate, EndDate); var statisticItems = items as IList<StatisticItem> ?? items.ToList(); if (!statisticItems.Any()) { return new PlotModel(); } var model = new PlotModel { Background = OxyColors.Black, TextColor = OxyColors.White }; var pieSeries = new PieSeries { AreInsideLabelsAngled = true, InsideLabelFormat = "{1}", OutsideLabelFormat = "{0}" }; foreach (var item in statisticItems) { pieSeries.Slices.Add(new PieSlice(item.Label, item.Value)); } model.Series.Add(pieSeries); return model; }
private PlotModel CreateDistributionPlotModel(IEnumerable<DistributionDto> data) { var model = new PlotModel { LegendPlacement = LegendPlacement.Outside, LegendPosition = LegendPosition.TopCenter, LegendOrientation = LegendOrientation.Horizontal, IsLegendVisible = true, LegendTextColor = GetDefaultTextColor(), }; var chartSerie = new PieSeries { StartAngle = 0, AngleSpan = 360, StrokeThickness = 2, Title = "Distribution" }; int i = 0; foreach (var item in data) { chartSerie.Slices.Add(new PieSlice(item.Category, item.Value) { Fill = _colorCycle[i], }); i = ++i % _colorCycle.Length; } model.Series.Add(chartSerie); return model; }
/// <summary> /// Set a custom CategprySpreadingModel with the set Start and Enddate /// </summary> private PlotModel GetSpreadingModel() { var items = speadingDataProvider.GetValues(StartDate, EndDate); var statisticItems = items as IList<StatisticItem> ?? items.ToList(); if (!statisticItems.Any()) { return new PlotModel(); } var model = new PlotModel { Background = OxyColors.Black, TextColor = OxyColors.White }; var pieSeries = new PieSeries { InsideLabelFormat = "" }; var colorIndex = 0; foreach (var item in statisticItems) { pieSeries.Slices.Add(new PieSlice(item.Label, item.Value) {Fill = colors[colorIndex]}); LegendList.Add(new LegendItem {Color = colors[colorIndex], Text = item.Label}); colorIndex ++; } model.Series.Add(pieSeries); return model; }
private void LoadPieChart(int flag = 0) { PieSeries.Clear(); PieSeries pie = null; foreach (var range in NumRanges) { double min = range.Min.HasValue ? (double)range.Min : 0; double max = range.Max.HasValue ? (double)range.Max : 100000; pie = new PieSeries { Title = range.Title, Values = new ChartValues <int> { PartyBuildingContext.org2news.Count( o => flag == 0? o.mem_count_dy >= min && o.mem_count_dy < max: o.emp_count >= min && o.emp_count < max ) }, DataLabels = true, PushOut = 2, LabelPoint = PiePointLabel }; PieSeries.Add(pie); } }
/// <summary> /// 初始化pie /// </summary> private void InitializePie(List <KeyValuePair <double, object> > data) { this.rcv_percent.AreaType = ChartAreaType.Pie; this.rcv_percent.ChartElement.View.ForeColor = Color.White; PieSeries pie = new PieSeries(); pie.ValueMember = "Value"; pie.LabelMode = PieLabelModes.Horizontal; pie.ShowLabels = true; pie.ForeColor = Color.White; if (data.Count == 0) { data.Add(new KeyValuePair <double, object>(0, "")); } foreach (KeyValuePair <double, object> dataItem in data) { PieDataPoint point = new PieDataPoint(dataItem.Key, dataItem.Value.ToString()); point.Label = Transformation(dataItem.Value.ToString()) + "(" + dataItem.Key.ToString() + ")"; pie.DataPoints.Add(point); } this.rcv_percent.Series.Add(pie); this.rcv_percent.ShowLegend = false; }
async protected override void OnAppearing() { base.OnAppearing(); var json = await GetSalesPerProductAsync(); var salesPerProduct = JsonConvert.DeserializeObject <Sales[]>(json); PlotModel modelForSales = new PlotModel { Title = "Sales Per Product", TitleColor = OxyColors.Teal, TitleFontSize = 30, TextColor = OxyColors.White, DefaultFont = "Arial Black", DefaultFontSize = 20 }; dynamic seriesP2 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0, FontSize = 24 }; foreach (Sales c in salesPerProduct) { seriesP2.Slices.Add(new PieSlice(c.PRODUCT_CODE, c.PRODUCT_ID)); } modelForSales.Series.Add(seriesP2); viewModelforSales.SalesPerProductModel = modelForSales; }
PlotModel CreatePieChart(String title, Dictionary <String, Int32> data) { var pm = new PlotModel(); var ps = new PieSeries(); pm.Title = title; pm.PlotMargins = new OxyThickness(0); pm.Padding = new OxyThickness(0); if (data.Count > 0) { var ranking = data.OrderByDescending(m => m.Value).Take(8); foreach (var element in ranking) { ps.Slices.Add(new PieSlice(element.Key, element.Value)); } } ps.InnerDiameter = 0.2; ps.ExplodedDistance = 0; ps.Stroke = OxyColors.White; ps.StrokeThickness = 1.0; ps.AngleSpan = 360; ps.StartAngle = 0; pm.Series.Add(ps); return(pm); }
private void CreateUWPPlot(CodeStats codeStats) { UwpPlotModel = new PlotModel { Title = "UWP" }; var pieSlice = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 }; pieSlice.Slices.Add(new PieSlice("Share", codeStats.ShareCodeInUWP) { IsExploded = true, Fill = OxyColors.Green }); pieSlice.Slices.Add(new PieSlice("Specific", codeStats.UWPSpecificCode) { IsExploded = true, Fill = OxyColors.Red }); UwpPlotModel.Series.Add(pieSlice); }
public static SeriesCollection GetGameResultSeries() { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; SeriesCollection seriesCollection = new SeriesCollection(); IEnumerable <IGrouping <string, Game> > results = RecordedGames.GroupBy(x => x.User.Result); Func <ChartPoint, string> labelPoint = chartPoint => string.Format("{0} ({1:P})", chartPoint.Y, chartPoint.Participation); foreach (var result in results) { if (result.Key != null) { string resultName = result.Key; int value = result.Count(); PieSeries series = new PieSeries { Title = textInfo.ToTitleCase(resultName.ToLower()), Values = new ChartValues <int> { value }, DataLabels = true, LabelPoint = labelPoint }; seriesCollection.Add(series); } } return(seriesCollection); }
// [ref] ${OxyPlot_HOME}/NET45/Examples/ExampleBrowser/ExampleBrowser.exe. static void runWorldPopulation() { var plotModel = new PlotModel(); plotModel.Title = "World population by continent"; var pieSeries1 = new PieSeries(); pieSeries1.InsideLabelPosition = 0.8; pieSeries1.StrokeThickness = 2; pieSeries1.Slices.Add(new PieSlice("Africa", 15.0)); pieSeries1.Slices.Add(new PieSlice("Americas", 13.0)); pieSeries1.Slices.Add(new PieSlice("Asia", 60.0)); pieSeries1.Slices.Add(new PieSlice("Europe", 11.0)); pieSeries1.Slices.Add(new PieSlice("Oceania", 1.0)); plotModel.Series.Add(pieSeries1); // String output_filename = "../data/visualization/oxyplot/pieseries_world_population.pdf"; using (var stream = File.Create(output_filename)) { PdfExporter.Export(plotModel, stream, 600, 400); } }
public void Refresh() { if (LoadTask == null || LoadTask.IsCompleted) { Task.Factory.StartNew(() => { var data = WakaAnalyzer.Recent7.LanguageCount();//获取所有语言统计信息 if (ListTool.HasElements(data)) { Series = new SeriesCollection(); data.ForEach(x => { App.Current.Dispatcher.Invoke((Action)(() => { var p = new PieSeries { Values = new ChartValues <double> { x.Item2 }, Title = x.Item1 }; Series.Add(p); })); }); } }); } }
public static PlotModel LinearAxes() { var model = new PlotModel("World population by continent"); // http://www.nationsonline.org/oneworld/world_population.htm // http://en.wikipedia.org/wiki/Continent var ps = new PieSeries(); ps.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = true }); ps.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true }); ps.Slices.Add(new PieSlice("Asia", 4157)); ps.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true }); ps.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true }); ps.InnerDiameter = 0; ps.ExplodedDistance = 0.0; ps.Stroke = OxyColors.White; ps.StrokeThickness = 2.0; ps.InsideLabelPosition = 0.8; ps.AngleSpan = 360; ps.StartAngle = 0; model.Series.Add(ps); return(model); }
void GetPieSeriesData() { List <string> titles = new List <string> { "C#", "Java", "Python" }; List <double> pieValues = new List <double> { 60, 30, 10 }; ChartValues <double> chartvalue = new ChartValues <double>(); SeriesCollection PieSeriesCollection = new SeriesCollection(); for (int i = 0; i < titles.Count; i++) { chartvalue = new ChartValues <double>(); chartvalue.Add(pieValues[i]); PieSeries series = new PieSeries(); series.DataLabels = true; series.Title = titles[i]; series.Values = chartvalue; PieSeriesCollection.Add(series); } pie2.Series = PieSeriesCollection; }
public UserControlPieChart(TCH tCH) { InitializeComponent(); _data = tCH; PieChartView.Series = new SeriesCollection(); for (int i = 0; i < _data.bill.Count; i++) { var tmp = new PieSeries() { Values = new ChartValues <int>() { _data.bill[i].Cost }, Title = _data.bill[i].CostName }; PieChartView.Series.Add( new PieSeries() { Values = new ChartValues <float> { _data.bill[i].Cost }, Title = _data.bill[i].CostName } ); } PieChartView.DataContext = this; }
protected void Page_Load(object sender, EventArgs e) { SeriesItem Pagado = new SeriesItem(20); Pagado.Name = "Pagado"; Pagado.Exploded = true; SeriesItem PorPagar = new SeriesItem(80); PorPagar.Name = "PorPagar"; PieSeries ps = new PieSeries(); ps.Items.Add(Pagado); ps.Items.Add(PorPagar); ps.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieLabelsPosition.Column; ps.LabelsAppearance.DataFormatString = "{0} %"; ps.TooltipsAppearance.Visible = false; ps.TooltipsAppearance.DataFormatString = "{0} %"; RadHtmlChart.PlotArea.Series.Add(ps); RadHtmlChart.DataBind(); }
public void Chart() { SeriesCollection_TypeOfCake = new SeriesCollection(); var db = DataProvider.Ins.DB; var list = (from ctdh in db.CT_DONHANG join banh in db.BANHs on ctdh.MABANH equals banh.MABANH select new { banh.LOAIBANH, total = ctdh.SL_MUA * banh.DONGIA }); var result = (from l in list join lb in db.LOAIBANHs on l.LOAIBANH equals lb.MALOAI select new { lb.TENLOAI, l.total }); var finalList = (from rs in result group rs by rs.TENLOAI into rsGroup select new { Name = rsGroup.Key, totalMoney = rsGroup.Sum(x => x.total) }).ToList(); for (int i = 0; i < finalList.Count; i++) { ChartValues <int> amount = new ChartValues <int>(); amount.Add(Convert.ToInt32(finalList[i].totalMoney)); PieSeries series = new PieSeries { Values = amount, Title = finalList[i].Name, }; SeriesCollection_TypeOfCake.Add(series); } }
private void SeriesStats() { var pieSeries = new PieSeries(); pieSeries.Slices.Add( new PieSlice( Strings.EndedSeries, Repositories.Series.EndedSeriesCount ) ); pieSeries.Slices.Add( new PieSlice( Strings.ContinuingSeries, Repositories.Series.ContinuingSeriesCount ) ); EndedSeriesPlot = new PlotModel(); EndedSeriesPlot.Series.Add( pieSeries ); var distributions = Repositories.Series.GetRatingDistribution(); var ratings = new List<RatingItem>(); for( int i = 0; i < 10; ++i ) { ratings.Add( new RatingItem { Rating = i.ToString(), Count = distributions.Where( r => r.Key >= i && r.Key < i + 1 ).Sum( r => r.Value ) } ); } SeriesRatingPlot = new PlotModel(); SeriesRatingPlot.Axes.Add( new CategoryAxis { ItemsSource = ratings, LabelField = nameof( RatingItem.Rating ) } ); SeriesRatingPlot.Axes.Add( new LinearAxis { Position = AxisPosition.Left } ); SeriesRatingPlot.Series.Add( new ColumnSeries { ItemsSource = ratings, ValueField = nameof( RatingItem.Count ) } ); }
public static SeriesCollection GetHeroSelectionSeries() { TextInfo textInfo = new CultureInfo("en-US", false).TextInfo; SeriesCollection seriesCollection = new SeriesCollection(); IEnumerable <IGrouping <int, Game> > results = RecordedGames.GroupBy(x => x.User.Deck.HeroDbfId); foreach (var result in results) { Card heroCard = Cards.GetFromDbfId(result.Key, false); if (heroCard != null) { PieSeries series = new PieSeries { Title = heroCard.Name, Values = new ChartValues <ObservableValue> { new ObservableValue(result.Count()) }, DataLabels = true }; seriesCollection.Add(series); } } return(seriesCollection); }
private static PlotModel CreatePieChart2() { var model = new PlotModel { Title = "Cricket world cup" }; var ps = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 }; ps.Slices.Add(new PieSlice("India", 1030) { IsExploded = true }); ps.Slices.Add(new PieSlice("Aus", 929) { IsExploded = true }); ps.Slices.Add(new PieSlice("Srilanka", 4157)); ps.Slices.Add(new PieSlice("England", 739) { IsExploded = true }); ps.Slices.Add(new PieSlice("Pakistan", 35) { IsExploded = true }); model.Series.Add(ps); return(model); }
private static PlotModel CreatePieChart() { var model = new PlotModel { Title = "World population by continent" }; var ps = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 }; ps.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = true }); ps.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true }); ps.Slices.Add(new PieSlice("Asia", 4157)); ps.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true }); ps.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true }); model.Series.Add(ps); return(model); }
public PlotModel Simplemodel(TableQuery <Expense> expenses) { var modelP1 = new PlotModel { Title = "Harcamalar" }; var seriesP1 = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.5, AngleSpan = 360, StartAngle = 0, InnerDiameter = 0.4 }; foreach (Expense expense in expenses) { totalAmounth = totalAmounth - expense.Amounth; seriesP1.Slices.Add(new PieSlice(expense.Name, expense.Amounth) { IsExploded = false }); } seriesP1.Slices.Add(new PieSlice("Gelir", totalAmounth) { IsExploded = false }); //Fill = OxyColors.PaleVioletRed //seriesP1.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = false }); //seriesP1.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true }); //seriesP1.Slices.Add(new PieSlice("Asia", 4157) { IsExploded = true }); //seriesP1.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true }); //seriesP1.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true }); modelP1.Series.Add(seriesP1); return(modelP1); }
public MainWindow() { this.InitializeComponent(); // http://www.nationsonline.org/oneworld/world_population.htm // http://en.wikipedia.org/wiki/Continent var plotModel = new PlotModel { Title = "World population by continent" }; var pieSeries = new PieSeries(); pieSeries.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = true }); pieSeries.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true }); pieSeries.Slices.Add(new PieSlice("Asia", 4157)); pieSeries.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true }); pieSeries.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true }); pieSeries.InnerDiameter = 0.2; pieSeries.ExplodedDistance = 0; pieSeries.Stroke = OxyColors.Black; pieSeries.StrokeThickness = 1.0; pieSeries.AngleSpan = 360; pieSeries.StartAngle = 0; plotModel.Series.Add(pieSeries); this.PieModel = plotModel; this.DataContext = this; }
public MainWindow() { InitializeComponent(); SfChart chart = new SfChart(); ViewModel viewModel = new ViewModel(); chart.DataContext = viewModel; chart.Header = "Weight Report"; chart.Legend = new ChartLegend(); // Defining the PieSeries with adornments. PieSeries series = new PieSeries(); series.XBindingPath = "Name"; series.YBindingPath = "Weight"; series.ItemsSource = viewModel.Data; series.AdornmentsInfo = new ChartAdornmentInfo() { ShowLabel = true }; chart.Series.Add(series); //Setting chart as Window's Content. Content = chart; }
public TripDetailScreen(int type, string maChuyenDi) { ObservableCollection <MucChi> mc = new ObservableCollection <MucChi>(); MucChiDAOlmpl mcDao = new MucChiDAOlmpl(); InitializeComponent(); this.type = type; this.maChuyenDi = maChuyenDi; tripDetailVM = new TripDetailVM(maChuyenDi); this.DataContext = tripDetailVM; PlaceListView.ItemsSource = tripDetailVM.loTrinhList; ImageListView.ItemsSource = tripDetailVM.hinhAnhList; ThanhVienListView.ItemsSource = tripDetailVM.thanhVienList; TongKetListView.ItemsSource = tripDetailVM.tongKet.ThanhVienTraLai; foreach (MucChi m in tripDetailVM.mucChiList) { PieSeries ps = new PieSeries() { Title = m.NDChi, Values = new ChartValues <int> { m.SoTien }, DataLabels = true }; myChart.Series.Add(ps); } myChart.FontSize = 12; myChart.Foreground = new SolidColorBrush(Colors.DimGray); }
public override View GetSampleContent(Context context) { var chart = new SfChart(context); chart.Title.Text = "Sales by Sales Person"; chart.Title.TextSize = 15; chart.SetBackgroundColor(Android.Graphics.Color.White); chart.Legend.Visibility = Visibility.Visible; chart.Legend.ToggleSeriesVisibility = true; chart.Legend.OverflowMode = ChartLegendOverflowMode.Wrap; chart.Legend.DockPosition = ChartDock.Bottom; chart.Legend.IconHeight = 14; chart.Legend.IconWidth = 14; pieSeries = new PieSeries(); pieSeries.TooltipEnabled = true; pieSeries.GroupTo = 25; pieSeries.ColorModel.ColorPalette = ChartColorPalette.Natural; pieSeries.ItemsSource = MainPage.GetPieData(); pieSeries.XBindingPath = "XValue"; pieSeries.YBindingPath = "YValue"; pieSeries.DataMarker.ShowLabel = true; pieSeries.DataMarker.LabelStyle.LabelFormat = "#.#'%'"; pieSeries.EnableAnimation = true; pieSeries.CircularCoefficient = 0.7; pieSeries.StrokeWidth = 1; pieSeries.StrokeColor = Android.Graphics.Color.White; chart.Series.Add(pieSeries); return(chart); }
private void loadReligionList() { List<string> aReligion = new List<string>(); int iCntReligionMale = 0; int iCntReligionFemale = 0; foreach (StudentEnrollment se in stEnrolled) { if (!aReligion.Contains(se.student.Religion)) { aReligion.Add(se.student.Religion); } } PieSeries series = new PieSeries(); series.ShowLabels = true; foreach (String religion in aReligion) { iCntReligionMale = stEnrolled.FindAll(x => x.student.Religion == religion && x.student.Gender == "M").Count; if (iCntReligionMale > 0) series.DataPoints.Add(new PieDataPoint(iCntReligionMale, religion + " Boys")); iCntReligionFemale = stEnrolled.FindAll(x => x.student.Religion == religion && x.student.Gender == "F").Count; if (iCntReligionFemale > 0) series.DataPoints.Add(new PieDataPoint(iCntReligionFemale, religion + " Girls")); } this.radChartView1.Series.Add(series); }
private void EpisodeStats() { var pieSeries = new PieSeries(); pieSeries.Slices.Add( new PieSlice( Strings.WatchedEpisodes, Repositories.Episodes.WatchedEpisodeCount ) ); pieSeries.Slices.Add( new PieSlice( Strings.UnwatchedEpisodes, Repositories.Episodes.UnwatchedEpisodeCount ) ); WatchedEpisodesPlot = new PlotModel(); WatchedEpisodesPlot.Series.Add( pieSeries ); UnwatchedEpisodeTime = Repositories.Episodes.UnwatchedEpisodeTime; WatchedEpisodeTime = Repositories.Episodes.WatchedEpisodeTime; }
public PlotModel CreatePlotModel(float unallocated) { var plotModel = new PlotModel { Title = "This Month's Split up" }; var pieSeries = new PieSeries(); pieSeries.InsideLabelPosition = 0.0; pieSeries.InsideLabelFormat = null; pieSeries.OutsideLabelFormat = null; /*we need the slice data from the list */ pieSeries.Slices = GetPieSlices(unallocated); plotModel.Series.Add(pieSeries); return plotModel; }
private RadPieChartView createChart() { RadPieChartView pieChart = new RadPieChartView(this.Activity); PieSeries pieSeries = new PieSeries(); pieSeries.ValueBinding = new ValueBinding(); pieSeries.ShowLabels = true; pieSeries.Data = this.getData(); pieChart.Series.Add(pieSeries); return pieChart; }
public override View GetSampleContent(Context context) { var chart = new SfChart(context); chart.SetBackgroundColor(Color.White); chart.Title.Text = "Products Growth - 2015"; chart.Legend.Visibility = Visibility.Visible; if (context.Resources.DisplayMetrics.HeightPixels > context.Resources.DisplayMetrics.WidthPixels) { int padding = (context.Resources.DisplayMetrics.HeightPixels - context.Resources.DisplayMetrics.WidthPixels) / 2; chart.SetPadding(0, padding / 2, 0, padding); chart.Legend.DockPosition = ChartDock.Bottom; } else { int padding = (context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.HeightPixels) / 2; chart.SetPadding(padding, 0, padding, 0); chart.Legend.ItemMarginRight = padding / 6; chart.Legend.DockPosition = ChartDock.Right; } var datas = new ObservableArrayList(); datas.Add(new ChartDataPoint("Product A", 14)); datas.Add(new ChartDataPoint("Product B", 54)); datas.Add(new ChartDataPoint("Product C", 23)); datas.Add(new ChartDataPoint("Product D", 53)); var pieSeries = new PieSeries { DataSource = datas, StartAngle = 180, EndAngle = 360, }; pieSeries.DataMarker.ShowLabel = true; pieSeries.DataMarker.LabelContent = LabelContent.Percentage; pieSeries.DataMarkerPosition = CircularSeriesDataMarkerPosition.Outside; chart.Series.Add(pieSeries); return chart; }
private void loadGenderList() { int iCntMale = 0; int iCntFemale = 0; PieSeries series = new PieSeries(); series.ShowLabels = true; iCntMale = stEnrolled.FindAll(x => x.student.Gender == "M").Count; if (iCntMale > 0) series.DataPoints.Add(new PieDataPoint(iCntMale, "Male")); iCntFemale = stEnrolled.FindAll(x => x.student.Gender == "F").Count; if (iCntFemale > 0) series.DataPoints.Add(new PieDataPoint(iCntFemale, "Female")); this.radChartView1.Series.Add(series); }
public static PlotModel LinearAxes() { var model = new PlotModel("World population by continent"); // http://www.nationsonline.org/oneworld/world_population.htm // http://en.wikipedia.org/wiki/Continent var ps = new PieSeries(); ps.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = true }); ps.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true }); ps.Slices.Add(new PieSlice("Asia", 4157)); ps.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true }); ps.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true }); ps.InnerDiameter = 0; ps.ExplodedDistance = 0.0; ps.Stroke = OxyColors.White; ps.StrokeThickness = 2.0; ps.InsideLabelPosition = 0.8; ps.AngleSpan = 360; ps.StartAngle = 0; model.Series.Add(ps); return model; }
// [ref] ${OxyPlot_HOME}/NET45/Examples/ExampleBrowser/ExampleBrowser.exe. static void runWorldPopulation() { var plotModel = new PlotModel(); plotModel.Title = "World population by continent"; var pieSeries1 = new PieSeries(); pieSeries1.InsideLabelPosition = 0.8; pieSeries1.StrokeThickness = 2; pieSeries1.Slices.Add(new PieSlice("Africa", 15.0)); pieSeries1.Slices.Add(new PieSlice("Americas", 13.0)); pieSeries1.Slices.Add(new PieSlice("Asia", 60.0)); pieSeries1.Slices.Add(new PieSlice("Europe", 11.0)); pieSeries1.Slices.Add(new PieSlice("Oceania", 1.0)); plotModel.Series.Add(pieSeries1); // String output_filename = "../data/visualization/oxyplot/pieseries_world_population.pdf"; using (var stream = File.Create(output_filename)) { PdfExporter.Export(plotModel, stream, 600, 400); } }
private static PlotModel CreateExample() { var model = new PlotModel { Title = "World population by continent" }; var ps = new PieSeries { StrokeThickness = 2.0, InsideLabelPosition = 0.8, AngleSpan = 360, StartAngle = 0 }; // http://www.nationsonline.org/oneworld/world_population.htm // http://en.wikipedia.org/wiki/Continent ps.Slices.Add(new PieSlice("Africa", 1030) { IsExploded = true }); ps.Slices.Add(new PieSlice("Americas", 929) { IsExploded = true }); ps.Slices.Add(new PieSlice("Asia", 4157)); ps.Slices.Add(new PieSlice("Europe", 739) { IsExploded = true }); ps.Slices.Add(new PieSlice("Oceania", 35) { IsExploded = true }); model.Series.Add(ps); return model; }
private static DoubleAnimation BuildSliceAnimation(Path path, TimeSpan? beginTime, Duration duration, Point center, PieSeries series) { var scaleTransform = new ScaleTransform(); scaleTransform.ScaleX = 0; scaleTransform.ScaleY = 0; scaleTransform.CenterX = center.X; scaleTransform.CenterY = center.Y; path.RenderTransform = scaleTransform; DoubleAnimation animation = new DoubleAnimation(); animation.From = 0; animation.To = 1; animation.Duration = duration; animation.EasingFunction = new BackEase() { EasingMode = EasingMode.EaseOut, Amplitude = 0.4 }; if (beginTime != null) { animation.BeginTime = beginTime; } Storyboard.SetTarget(animation, path); Storyboard.SetTargetProperty(animation, new PropertyPath(ChartAnimationUtilities.SliceScaleTransformXYProperty)); return animation; }
public void CreateChart(Panel BasePanel, ChartType chartType, DataTable dt, string[] ColorName) { switch (chartType) { case ChartType.BarChartHorizontal: radChart.Skin = "Silk"; radChart.Layout = Telerik.Web.UI.HtmlChart.ChartLayout.Default; BarSeries[] CBS = new BarSeries[dt.Columns.Count - 1]; for (int i = 0; i < dt.Columns.Count - 1 ; i++) { CBS[i] = new BarSeries(); CBS[i].Name = dt.Columns[i + 1].ColumnName; CBS[i].LabelsAppearance.Visible = true; CBS[i].TooltipsAppearance.Color = System.Drawing.Color.White; CBS[i].LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.OutsideEnd; } foreach (DataRow row in dt.Rows) { for (int i = 0; i < dt.Columns.Count - 1; i++) { CBS[i].SeriesItems.Add(new CategorySeriesItem((Int64)row[i + 1])); radChart.PlotArea.XAxis.Items.Add(row[0].ToString()); } } foreach (BarSeries item in CBS) { radChart.PlotArea.Series.Add(item); } break; case ChartType.BarChartHorizontalDA: radChart.Skin = "Silk"; radChart.Layout = Telerik.Web.UI.HtmlChart.ChartLayout.Default; BarSeries[] BS = new BarSeries[dt.Columns.Count - 1]; for (int i = 0; i < dt.Columns.Count - 1; i++) { BS[i] = new BarSeries(); BS[i].Name = dt.Columns[i + 1].ColumnName; BS[i].LabelsAppearance.Visible = true; BS[i].TooltipsAppearance.Color = System.Drawing.Color.White; BS[i].LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.OutsideEnd; } int j = 0; foreach (DataRow row in dt.Rows) { for (int i = 0; i < dt.Columns.Count - 1; i++) { BS[i].SeriesItems.Add(new CategorySeriesItem((Int64)row[i + 1])); //BS[i].Appearance.FillStyle.BackgroundColor = Color.FromName(ColorName[j]); radChart.PlotArea.XAxis.Items.Add(row[0].ToString()); } j++; } //for (int i = 0; i < ColorName.Length - 1; i++) //{ // BS[0]. // //BS[0].Appearance.FillStyle.BackgroundColor = Color.FromName(color); //} //for (int i = 0; i < ColorName.Length - 1; i++) //{ // CBS..Appearance.FillStyle.BackgroundColor = Color.FromName(ColorName[i].ToString()); //} foreach (BarSeries item in BS) { radChart.PlotArea.Series.Add(item); } break; case ChartType.BarChartVartical: radChart.Skin = "Silk"; radChart.Layout = Telerik.Web.UI.HtmlChart.ChartLayout.Default; //radChart.PlotArea.XAxis.LabelsAppearance.RotationAngle = -90; ColumnSeries[] CCS = new ColumnSeries[dt.Columns.Count - 1]; for (int i = 0; i < dt.Columns.Count - 1 ; i++) { CCS[i] = new ColumnSeries(); CCS[i].Name = dt.Columns[i + 1].ColumnName; CCS[i].LabelsAppearance.Visible = true; CCS[i].TooltipsAppearance.Color = System.Drawing.Color.White; CCS[i].LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.OutsideEnd; } foreach (DataRow row in dt.Rows) { for (int i = 0; i < dt.Columns.Count - 1; i++) CCS[i].SeriesItems.Add(new CategorySeriesItem((Int64)row[i + 1])); radChart.PlotArea.XAxis.Items.Add(row[0].ToString()); } foreach (ColumnSeries item in CCS) { radChart.PlotArea.Series.Add(item); } break; case ChartType.PieChart: radChart.Skin = "Silk"; radChart.Layout = Telerik.Web.UI.HtmlChart.ChartLayout.Default; PieSeries PS = new PieSeries(); PS.Name = "PieSeries1"; PS.StartAngle = 90; PS.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieAndDonutLabelsPosition.Center; PS.LabelsAppearance.Visible = true; PS.TooltipsAppearance.Color = System.Drawing.Color.White; bool IsExploded = true; foreach (DataRow row in dt.Rows) { PieSeriesItem psi = new PieSeriesItem(); psi.Name = row[0].ToString(); psi.Y = (Int64)row[1]; if (IsExploded) { psi.Exploded = IsExploded; IsExploded = false; } PS.SeriesItems.Add(psi); } radChart.PlotArea.Series.Add(PS); break; case ChartType.LineChart: radChart.Skin = "Silk"; radChart.Layout = Telerik.Web.UI.HtmlChart.ChartLayout.Default; LineSeries[] CLS = new LineSeries[dt.Columns.Count - 1]; for (int i = 0; i < dt.Columns.Count - 1 ; i++) { CLS[i] = new LineSeries(); CLS[i].Name = dt.Columns[i + 1].ColumnName; CLS[i].LabelsAppearance.Visible = true; CLS[i].TooltipsAppearance.Color = System.Drawing.Color.White; CLS[i].LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.LineAndScatterLabelsPosition.Above; } foreach (DataRow row in dt.Rows) { for (int i = 0; i < dt.Columns.Count - 1; i++) CLS[i].SeriesItems.Add(new CategorySeriesItem((Int64)row[i + 1])); radChart.PlotArea.XAxis.Items.Add(row[0].ToString()); } foreach (LineSeries item in CLS) radChart.PlotArea.Series.Add(item); break; case ChartType.AreaChart: AreaSeries[] CAS = new AreaSeries[dt.Columns.Count - 1]; for (int i = 0; i < dt.Columns.Count - 1 ; i++) { CAS[i] = new AreaSeries(); CAS[i].Name = dt.Columns[i + 1].ColumnName; CAS[i].LabelsAppearance.Visible = false; CAS[i].TooltipsAppearance.Color = System.Drawing.Color.White; CAS[i].Appearance.FillStyle.BackgroundColor = Color.FromName(ColorName[i]); } foreach (DataRow row in dt.Rows) { for (int i = 0; i < dt.Columns.Count - 1; i++) CAS[i].SeriesItems.Add(new CategorySeriesItem((Int64)row[i + 1])); radChart.PlotArea.XAxis.Items.Add(row[0].ToString()); } foreach (AreaSeries item in CAS) radChart.PlotArea.Series.Add(item); break; default: break; } BasePanel.Controls.Add(radChart); }
public void PieSeries() { var s1 = new OxyPlot.Series.PieSeries(); var s2 = new PieSeries(); OxyAssert.PropertiesAreEqual(s1, s2); }
private static bool TryRunSweepAngleAnimtation(PieSeries series) { double sweepAngle = (double)series.GetAnimationBaseValue(ChartAnimationUtilities.SweepAngleProperty); if (double.IsNaN(sweepAngle)) { series.SetValue(ChartAnimationUtilities.SweepAngleProperty, series.AngleRange.SweepAngle); sweepAngle = series.AngleRange.SweepAngle; } DoubleAnimation animation = new DoubleAnimation(); animation.From = 0.0; animation.To = sweepAngle; animation.Duration = AnimationDuration; animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut, }; Storyboard.SetTargetProperty(animation, new PropertyPath(ChartAnimationUtilities.SweepAngleProperty)); Storyboard.SetTarget(animation, series); Storyboard storyboard = new Storyboard(); storyboard.Children.Add(animation); return Run(storyboard, series); }
private static bool TryRunRadiusFactorAnimtation(PieSeries series) { DoubleAnimation animation = new DoubleAnimation(); animation.From = 0.0; animation.Duration = AnimationDuration; animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut, }; Storyboard.SetTargetProperty(animation, new PropertyPath(PieSeries.RadiusFactorProperty)); Storyboard.SetTarget(animation, series); Storyboard storyboard = new Storyboard(); storyboard.Children.Add(animation); return Run(storyboard, series); }
private static bool TryRunSliceAnimtation(PieSeries series) { Canvas renderSurface = Telerik.Windows.Controls.ChildrenOfTypeExtensions.FindChildByType<Canvas>(series); List<Path> slices = new List<Path>(); foreach (UIElement uiElement in renderSurface.Children) { Path slice = uiElement as Path; if (slice != null && slice.DataContext is PieDataPoint) { slices.Add(slice); } } Storyboard storyboard = new Storyboard(); Point center = new Point(series.Chart.ActualWidth / 2, series.Chart.ActualHeight / 2); TimeSpan? beginTime = null; for (int i = 0; i < slices.Count; i++) { var animation = BuildSliceAnimation(slices[i], beginTime, PieSliceAnimationDuration, center, series); storyboard.Children.Add(animation); beginTime = new TimeSpan(0, 0, 0, 0, PieDelayInMilliseconds * (i + 1) / slices.Count); } bool showLabels = series.ShowLabels; series.ShowLabels = false; Action completed = () => series.ShowLabels = showLabels; bool started = Run(storyboard, series, completed); if (!started) { completed(); } return started; }
private void CargarPastelSexo() { rcViewPastel.Series.Clear(); rcViewPastel.Title = " Grafico de Pastel para la Frecuencia de Sexo en : " + cboEnfermedad.Text; rcViewPastel.ShowTitle = true; this.rcViewPastel.ChartElement.LegendPosition = LegendPosition.Float; this.rcViewPastel.ChartElement.LegendOffset = new Point(600, 100); foreach (DataRow dr in dtPie.Rows) { if (dr[0].ToString() == cboEnfermedad.Text) { this.rcViewPastel.AreaType = ChartAreaType.Pie; //DataTable dtt = new DataTable(); //dtt.Columns.Add("Sexo"); //dtt.Columns.Add("Valor"); //dtt.Rows.Add("Femenino", dr[1].ToString()); //dtt.Rows.Add("Masculino", dr[2].ToString()); rcViewPastel.View.Palette = KnownPalette.Cold; PieSeries series = new PieSeries(); //series.DataMember = "Valor"; //series.DataSource = dtt; this.rcViewPastel.ShowLegend = true; this.rcViewPastel.LegendTitle = "Leyenda"; series.DataPoints.Add(new PieDataPoint(Convert.ToDouble(dr[1]), "Masculino")); series.DataPoints.Add(new PieDataPoint(Convert.ToDouble(dr[2]), "Femenino")); string[] regionNames = new string[] { "Femenino", "Masculino" }; this.rcViewPastel.Series.Add(series); for (int i = 0; i < series.DataPoints.Count; i++) { ((PieDataPoint)series.DataPoints[i]).Name = regionNames[i]; this.rcViewPastel.ChartElement.LegendElement.Items[i].Title = regionNames[i]; } series.ShowLabels = true; this.rcViewPastel.ChartElement.LegendElement.TitleElement.Font = new Font(rcView.ChartElement.Font.FontFamily.Name, 18); foreach (LegendItemElement item in this.rcViewPastel.ChartElement.LegendElement.StackElement.Children) { item.Font = new Font(rcViewPastel.ChartElement.Font.FontFamily.Name, 14); } break; } } }
PlotModel GetPie(SubCategoryStat stats, TeamType team) { PlotModel model = new PlotModel (); PieSeries ps = new PieSeries (); foreach (PercentualStat st in stats.OptionStats) { double count = GetCount (st, team); if (count == 0) continue; ps.Slices.Add (new PieSlice (st.Name, count)); } ps.InnerDiameter = 0; ps.ExplodedDistance = 0.0; ps.Stroke = OxyColors.White; ps.StrokeThickness = 2.0; ps.InsideLabelPosition = 0.8; ps.AngleSpan = 360; ps.StartAngle = 0; if (team == TeamType.LOCAL) { ps.Title = HomeName; } else if (team == TeamType.VISITOR) { ps.Title = AwayName; } OxyColor text_color = OxyColor.FromArgb (LongoMatch.App.Current.Style.PaletteText.A, LongoMatch.App.Current.Style.PaletteText.R, LongoMatch.App.Current.Style.PaletteText.G, LongoMatch.App.Current.Style.PaletteText.B); model.TextColor = text_color; model.TitleColor = text_color; model.SubtitleColor = text_color; model.Series.Add (ps); return model; }
private void BindQuotesAndTradesChart() { List<Browser> browsers = new List<Browser>(); LoansBLL loansBLL = new LoansBLL(); DataSet ds = new DataSet(); ds = loansBLL.GetLoanCountryGraphDetails(); if (ds.Tables[1].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[1].Rows) { browsers.Add(new Browser("Trades", Convert.ToDouble(dr["Trades"]), false)); browsers.Add(new Browser("Quotes", Convert.ToDouble(dr["Quotes"]), false)); } } PieSeries ps = new PieSeries(); foreach (var item in browsers) { SeriesItem s1 = new SeriesItem(); s1.Name = item.Name; s1.Exploded = item.IsExploded; s1.YValue = Convert.ToDecimal(item.MarketShare); ps.Items.Add(s1); } // ps.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieLabelsPosition.Column; // removed by Nik 20 03 after upgrade version // ps.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieLabelsPosition.Column; PieChart2.PlotArea.Series.Add(ps); PieChart2.DataBind(); BindNuberofCounterPartyChar(); }
private void SetSpreadingModel(IEnumerable<StatisticItem> items) { var statisticItems = items as IList<StatisticItem> ?? items.ToList(); if (!statisticItems.Any()) { return; } var model = new PlotModel { Background = OxyColors.Black, TextColor = OxyColors.White }; var pieSeries = new PieSeries(); foreach (var item in statisticItems) { pieSeries.Slices.Add(new PieSlice(item.Label, item.Value)); } model.IsLegendVisible = true; model.LegendPosition = LegendPosition.BottomLeft; model.Series.Add(pieSeries); SpreadingModel = model; }
PlotModel CreatePieChart(String title, Dictionary<String, Int32> data) { var pm = new PlotModel(); var ps = new PieSeries(); pm.Title = title; pm.PlotMargins = new OxyThickness(0); pm.Padding = new OxyThickness(0); if (data.Count > 0) { var ranking = data.OrderByDescending(m => m.Value).Take(8); foreach (var element in ranking) ps.Slices.Add(new PieSlice(element.Key, element.Value)); } ps.InnerDiameter = 0.2; ps.ExplodedDistance = 0; ps.Stroke = OxyColors.White; ps.StrokeThickness = 1.0; ps.AngleSpan = 360; ps.StartAngle = 0; pm.Series.Add(ps); return pm; }
private void InitializeChart(RadPieChart chart, Location location) { this.SetChartDimensions(chart); randoms = new double[] { rand.Next(10000, 50000), rand.Next(10000, 50000), rand.Next(10000, 50000) }; double sum = randoms[0] + randoms[1] + randoms[2]; PieSeries series = new PieSeries() { ShowLabels = false }; series.ItemsSource = new double[] { randoms[0], randoms[1], randoms[2] }; chart.Series.Add(series); chart.Palette = ChartPalettes.Windows8; chart.SetValue(MapLayer.LocationProperty, location); this.VisualizationLayer.Items.Add(chart); HeaderedItemsControl legend = new HeaderedItemsControl(); this.InitializeMapLegend((int)((randoms[0] * 100) / sum), (int)((randoms[1] * 100) / sum), (int)((randoms[2] * 100) / sum), legend, legendLocations[i++]); }
private void LoadPerformanceByWells(string name) { var series = new PieSeries { ShowLabels = true }; series.LabelDefinitions.Add(new ChartSeriesLabelDefinition { Binding = new PropertyNameDataPointBinding { PropertyName = "WellName" } }); series.ValueBinding = new GenericDataPointBinding<FieldPerformanceByWellsViewModel, double> { ValueSelector = fp => fp.Production }; series.ItemsSource = GetPerformanceByWells(name); PerformanceByWells.Series.Clear(); PerformanceByWells.Series.Add(series); }
private void loadGradeSectionList() { this.radChartView1.Series.Clear(); List<GradeSection> gs = new List<GradeSection>(regService.GetAllGradeSection(cmbGradeLevel.SelectedValue.ToString())); int iCntGradeSectionMale = 0; int iCntGradeSectionFemale = 0; string gradelevel = cmbGradeLevel.SelectedValue.ToString(); PieSeries series = new PieSeries(); series.ShowLabels = true; foreach (GradeSection section in gs) { iCntGradeSectionMale = stEnrolled.FindAll(x => x.GradeLevel == gradelevel && x.GradeSectionCode == section.GradeSectionCode && x.student.Gender == "M").Count; if (iCntGradeSectionMale > 0) series.DataPoints.Add(new PieDataPoint(iCntGradeSectionMale, section.Section + " Boys")); iCntGradeSectionFemale = stEnrolled.FindAll(x => x.GradeLevel == gradelevel && x.GradeSectionCode == section.GradeSectionCode && x.student.Gender == "F").Count; if (iCntGradeSectionFemale > 0) series.DataPoints.Add(new PieDataPoint(iCntGradeSectionFemale, section.Section + " Girls")); } this.radChartView1.Series.Add(series); }
private void loadGradeLevelList() { List<GradeLevel> sortedGL = new List<GradeLevel>(); List<GradeLevel> gradeLevel = new List<GradeLevel>(regService.GetAllGradeLevel()); gradeLevel.RemoveAll(x => x.GradeLev == "0"); int iCntGradeLevelMale = 0; int iCntGradeLevelFemale = 0; PieSeries series = new PieSeries(); series.ShowLabels = true; foreach (GradeLevel gl in gradeLevel) { iCntGradeLevelMale = stEnrolled.FindAll(x => x.student.GradeLevel == gl.GradeLev && x.student.Gender == "M").Count; if (iCntGradeLevelMale > 0) series.DataPoints.Add(new PieDataPoint(iCntGradeLevelMale, gl.Description + " Boys")); iCntGradeLevelFemale = stEnrolled.FindAll(x => x.student.GradeLevel == gl.GradeLev && x.student.Gender == "F").Count; if (iCntGradeLevelFemale > 0) series.DataPoints.Add(new PieDataPoint(iCntGradeLevelFemale, gl.Description + " Girls")); } this.radChartView1.Series.Add(series); }