private IEnumerable <Series> GetSeries(IEnumerable <BubbleValue> values) { var sList = new List <Series>(); var seriesName = string.Empty; Series s = null; BubbleSeriesView bubbleSeriesViewAlways = null; foreach (var val in values) { if (seriesName == string.Empty || seriesName != val.SeriesName) { if (seriesName != string.Empty) { sList.Add(s); } seriesName = val.SeriesName; s = new Series("Data Series " + val.SeriesName, ViewType.Bubble) { ArgumentScaleType = ScaleType.Auto, ValueScaleType = ScaleType.Numerical, LabelsVisibility = DevExpress.Utils.DefaultBoolean.True, Name = val.SeriesName }; bubbleSeriesViewAlways = new BubbleSeriesView(); } s.View = bubbleSeriesViewAlways; s.Points.Add(new SeriesPoint(val.Xvalue, GetYvalue(val), val.Count)); } if (seriesName != string.Empty) { sList.Add(s); } return(sList); }
private void Form1_Load(object sender, EventArgs e) { // Create a new chart. ChartControl chart = new ChartControl(); chart.Dock = DockStyle.Fill; this.Controls.Add(chart); // Create a series. // Specify its data source and data members. Series series = new Series("Champions League Statistics", ViewType.Bubble); series.DataSource = DataPoint.GetDataPoints(); series.ArgumentDataMember = "GoalsScored"; series.ValueDataMembers.AddRange(new string[] { "GoalsConceded", "Points" }); // You can also call the SetBubbleDataMembers method to specify data members. //series.SetBubbleDataMembers("GoalsScored", "GoalsConceded", "Points"); chart.Series.Add(series); // Enable point labels and format their text. series.LabelsVisibility = DevExpress.Utils.DefaultBoolean.True; series.Label.TextPattern = "{Country}"; // Configure the bubble series appearance. BubbleSeriesView view = (BubbleSeriesView)series.View; view.AutoSize = false; view.MaxSize = 30; view.MinSize = 10; view.BubbleMarkerOptions.Kind = MarkerKind.Circle; view.ColorEach = true; // Fine-tune the whole range to avoid trimmed bubbles and redundant empty spaces on the chart. XYDiagram diagram = chart.Diagram as XYDiagram; diagram.AxisY.WholeRange.MaxValue = 165; diagram.AxisY.WholeRange.AlwaysShowZeroLevel = false; // Specify titles. diagram.AxisX.Title.Text = "Goals Scored"; diagram.AxisY.Title.Text = "Goals Conceded"; chart.Titles.Add(new ChartTitle { Text = "Champions League Statistics by Country" }); // Disable the legend. chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; }
void UpdateChart(SeriesCollection series, ScatterChartDashboardItem chartDashboardItem) { ScatterChartConstantLineUserData moduleData = GetDataFromString(chartDashboardItem.CustomProperties.GetValue(PropertyName)); if (moduleData != null && moduleData.Enabled) { BubbleSeriesView seriesView = series.OfType <Series>().Where(s => s.View is BubbleSeriesView).Select(s => s.View as BubbleSeriesView).FirstOrDefault(); if (seriesView != null) { seriesView.AxisX.ConstantLines.Clear(); seriesView.AxisY.ConstantLines.Clear(); SetUpLine(seriesView.AxisX, ColorTranslator.FromHtml("#14abb7"), ColorTranslator.FromHtml("#0e9ca9"), moduleData.VerticalAxisValue); SetUpLine(seriesView.AxisY, ColorTranslator.FromHtml("#14abb7"), ColorTranslator.FromHtml("#0e9ca9"), moduleData.HorizontalAxisValue); } } }