/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { m_ChartView = new NChartView(); NDockPanel dockPanel = new NDockPanel(); m_ChartView.Surface.Content = dockPanel; NLabel label = new NLabel(); label.Margins = new NMargins(10); label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 12); label.TextFill = new NColorFill(NColor.Black); label.TextAlignment = ENContentAlignment.MiddleCenter; label.Text = "Multiple Legends"; NDockLayout.SetDockArea(label, ENDockArea.Top); dockPanel.AddChild(label); // stack panel holding content NStackPanel stackPanel = new NStackPanel(); stackPanel.UniformHeights = ENUniformSize.Max; stackPanel.FillMode = ENStackFillMode.Equal; stackPanel.FitMode = ENStackFitMode.Equal; NDockLayout.SetDockArea(stackPanel, ENDockArea.Center); dockPanel.AddChild(stackPanel); // first group of pie + legend NDockPanel firstGroupPanel = new NDockPanel(); stackPanel.AddChild(firstGroupPanel); m_PieChart1 = CreatePieChart(); m_Legend1 = CreateLegend(); m_PieChart1.Legend = m_Legend1; firstGroupPanel.AddChild(m_Legend1); firstGroupPanel.AddChild(m_PieChart1); // second group of pie + legend NDockPanel secondGroupPanel = new NDockPanel(); stackPanel.AddChild(secondGroupPanel); // setup the volume chart m_PieChart2 = CreatePieChart(); m_Legend2 = CreateLegend(); m_PieChart2.Legend = m_Legend2; secondGroupPanel.AddChild(m_Legend2); secondGroupPanel.AddChild(m_PieChart2); m_ChartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, true)); return(m_ChartView); }
protected override void CreateItemsControls(NStackPanel stack) { NButton triangularGrid6 = new NButton("Create Triangular Grid (levels 6)"); triangularGrid6.Click += delegate(NEventArgs args) { this.CreateTriangularGridDiagram(6); }; stack.AddChild(triangularGrid6); NButton triangularGrid8 = new NButton("Create Triangular Grid (levels 8)"); triangularGrid8.Click += delegate(NEventArgs args) { this.CreateTriangularGridDiagram(8); }; stack.AddChild(triangularGrid8); NButton random10 = new NButton("Random (fixed 10, free 10)"); random10.Click += delegate(NEventArgs args) { this.CreateRandomBarycenterDiagram(10, 10); }; stack.AddChild(random10); NButton random15 = new NButton("Random (fixed 15, free 15)"); random15.Click += delegate(NEventArgs args) { this.CreateRandomBarycenterDiagram(15, 15); }; stack.AddChild(random15); }
/// <summary> /// /// </summary> /// <returns></returns> protected override NWidget CreateExampleContent() { m_ChartView = new NChartView(); NDockPanel dockPanel = new NDockPanel(); m_ChartView.Surface.Content = dockPanel; NLabel label = new NLabel(); label.Margins = new NMargins(10); label.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 12); label.TextFill = new NColorFill(NColor.Black); label.TextAlignment = ENContentAlignment.MiddleCenter; label.Text = "Aligning Chart Areas"; NDockLayout.SetDockArea(label, ENDockArea.Top); dockPanel.AddChild(label); // configure title NStackPanel stackPanel = new NStackPanel(); stackPanel.UniformHeights = ENUniformSize.Max; stackPanel.FillMode = ENStackFillMode.Equal; stackPanel.FitMode = ENStackFitMode.Equal; NDockLayout.SetDockArea(stackPanel, ENDockArea.Center); dockPanel.AddChild(stackPanel); NCartesianChart stockPriceChart = new NCartesianChart(); stockPriceChart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XValueTimelineYLinear); stockPriceChart.FitMode = ENCartesianChartFitMode.Stretch; stockPriceChart.Margins = new NMargins(10, 0, 10, 10); ConfigureInteractivity(stockPriceChart); stackPanel.AddChild(stockPriceChart); // setup the stock series m_StockPrice = new NStockSeries(); stockPriceChart.Series.Add(m_StockPrice); m_StockPrice.Name = "Price"; m_StockPrice.LegendView.Mode = ENSeriesLegendMode.None; m_StockPrice.DataLabelStyle = new NDataLabelStyle(false); m_StockPrice.CandleShape = ENCandleShape.Stick; m_StockPrice.UpStroke = new NStroke(1, NColor.RoyalBlue); m_StockPrice.CandleWidth = 10; m_StockPrice.UseXValues = true; m_StockPrice.InflateMargins = false; // setup the volume chart NCartesianChart stockVolumeChart = new NCartesianChart(); stockVolumeChart.SetPredefinedCartesianAxes(ENPredefinedCartesianAxis.XValueTimelineYLinear); stockVolumeChart.FitMode = ENCartesianChartFitMode.Stretch; stockVolumeChart.Margins = new NMargins(10, 0, 10, 10); ConfigureInteractivity(stockVolumeChart); stackPanel.AddChild(stockVolumeChart); // setup the stock volume series // setup the volume series m_StockVolume = new NAreaSeries(); stockVolumeChart.Series.Add(m_StockVolume); m_StockVolume.Name = "Volume"; m_StockVolume.DataLabelStyle = new NDataLabelStyle(false); m_StockVolume.LegendView.Mode = ENSeriesLegendMode.None; m_StockVolume.Fill = new NColorFill(NColor.YellowGreen); m_StockVolume.UseXValues = true; // make sure all axes are synchronized stockPriceChart.Axes[ENCartesianAxis.PrimaryX].SynchronizedAxes = new NDomArray <NNodeRef>(new NNodeRef(stockVolumeChart.Axes[ENCartesianAxis.PrimaryX])); stockVolumeChart.Axes[ENCartesianAxis.PrimaryX].SynchronizedAxes = new NDomArray <NNodeRef>(new NNodeRef(stockPriceChart.Axes[ENCartesianAxis.PrimaryX])); GenerateData(); // align the left parts of those charts NAlignmentGuidelineCollection guideLines = new NAlignmentGuidelineCollection(); NAlignmentGuideline guideLine = new NAlignmentGuideline(); guideLine.ContentSide = ENContentSide.Left; guideLine.Targets = new NDomArray <NNodeRef>(new NNodeRef[] { new NNodeRef(stockPriceChart), new NNodeRef(stockVolumeChart) }); guideLines.Add(guideLine); m_ChartView.Surface.AlignmentGuidelines = guideLines; m_ChartView.Document.StyleSheets.ApplyTheme(new NChartTheme(ENChartPalette.Bright, false)); return(m_ChartView); }