Exemple #1
0
        private NListBoxItem CreateDetailedListBoxItem(int index)
        {
            NDockPanel dock = new NDockPanel();

            dock.HorizontalSpacing = 3;
            dock.Padding           = new NMargins(0, 2, 0, 2);

            // Add the image
            string imageName = ImageNames[index % ImageNames.Length];
            NImage icon      = new NImage(new NEmbeddedResourceRef(NResources.Instance, "RIMG__24x24_" + imageName + "_png"));

            NImageBox imageBox = new NImageBox(icon);

            imageBox.HorizontalPlacement = ENHorizontalPlacement.Center;
            imageBox.VerticalPlacement   = ENVerticalPlacement.Center;
            NDockLayout.SetDockArea(imageBox, ENDockArea.Left);

            dock.Add(imageBox);

            // Add the title
            NLabel titleLabel = new NLabel("Item " + index.ToString());

            titleLabel.Font = new NFont(NFontDescriptor.DefaultSansFamilyName, 10, ENFontStyle.Bold);
            NDockLayout.SetDockArea(titleLabel, ENDockArea.Top);
            dock.AddChild(titleLabel);

            // Add the description
            NLabel descriptionLabel = new NLabel("This is item " + index.ToString() + "'s description.");

            NDockLayout.SetDockArea(descriptionLabel, ENDockArea.Center);
            dock.AddChild(descriptionLabel);

            return(new NListBoxItem(dock));
        }
        /// <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);
        }
        /// <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);
        }