public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Ternary Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); NLegend legend = new NLegend(); nChartControl1.Panels.Add(legend); // setup chart NTernaryChart ternaryChart = new NTernaryChart(); nChartControl1.Panels.Add(ternaryChart); ternaryChart.DisplayOnLegend = legend; ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryA)); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryB)); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryC)); // add a bubble series m_BubbleSeries = new NTernaryBubbleSeries(); ternaryChart.Series.Add(m_BubbleSeries); m_BubbleSeries.DataLabelStyle.VertAlign = VertAlign.Center; m_BubbleSeries.DataLabelStyle.Visible = false; m_BubbleSeries.Legend.Mode = SeriesLegendMode.DataPoints; m_BubbleSeries.MinSize = new NLength(2.0f, NGraphicsUnit.Point); m_BubbleSeries.MaxSize = new NLength(20, NGraphicsUnit.Point); m_BubbleSeries.Legend.Mode = SeriesLegendMode.DataPoints; m_BubbleSeries.Legend.Format = "<size>"; Random rand = new Random(); for (int i = 0; i < 20; i++) { // will be automatically normalized so that the sum of a, b, c value is 100 double aValue = rand.Next(100); double bValue = rand.Next(100); double cValue = rand.Next(100); m_BubbleSeries.AValues.Add(aValue); m_BubbleSeries.BValues.Add(bValue); m_BubbleSeries.CValues.Add(cValue); m_BubbleSeries.Sizes.Add(10 + rand.Next(90)); } // apply layout ConfigureStandardLayout(ternaryChart, title, nChartControl1.Legends[0]); // init form controls BubbleShapeCombo.FillFromEnum(typeof(PointShape)); BubbleShapeCombo.SelectedIndex = 6; DifferentColors.Checked = true; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(BubbleShapeDropDownList, typeof(PointShape)); DifferentColorsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Ternary Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NTernaryChart ternaryChart = new NTernaryChart(); nChartControl1.Panels.Add(ternaryChart); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryA)); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryB)); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryC)); // add a bubble series NTernaryBubbleSeries bubbleSeries = new NTernaryBubbleSeries(); ternaryChart.Series.Add(bubbleSeries); bubbleSeries.DataLabelStyle.VertAlign = VertAlign.Center; bubbleSeries.DataLabelStyle.Visible = false; bubbleSeries.Legend.Mode = SeriesLegendMode.DataPoints; bubbleSeries.MinSize = new NLength(2.0f, NGraphicsUnit.Point); bubbleSeries.MaxSize = new NLength(20, NGraphicsUnit.Point); bubbleSeries.Legend.Mode = SeriesLegendMode.DataPoints; bubbleSeries.Legend.Format = "<size>"; bubbleSeries.Shape = (PointShape)BubbleShapeDropDownList.SelectedIndex; Random rand = new Random(); for (int i = 0; i < 20; i++) { // will be automatically normalized so that the sum of a, b, c value is 100 double aValue = rand.Next(100); double bValue = rand.Next(100); double cValue = rand.Next(100); bubbleSeries.AValues.Add(aValue); bubbleSeries.BValues.Add(bValue); bubbleSeries.CValues.Add(cValue); bubbleSeries.Sizes.Add(10 + rand.Next(90)); } // apply layout ApplyLayoutTemplate(0, nChartControl1, ternaryChart, title, null); if (DifferentColorsCheckBox.Checked) { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); } else { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); } }