private void UpdateMiniCharts() { if (m_bLockUpdate == true) { return; } m_Chart.RemoveDescendantsOfType(typeof(NAnchorPanel)); m_Chart.Series.Clear(); // add bar and change bar color m_PointSeries = (NPointSeries)m_Chart.Series.Add(SeriesType.Point); // use custom X positions m_PointSeries.UseXValues = true; m_PointSeries.Size = new NLength(12, NRelativeUnit.ParentPercentage); // this will require to set the InflateMargins flag to true since in this mode // scale is determined only by the X positions of the shape and will not take // into account the size of the bubbles. m_PointSeries.InflateMargins = true; m_PointSeries.PointShape = (PointShape)PointStyleComboBox.SelectedIndex; m_PointSeries.DataLabelStyle.Visible = false; // populate the shape series of the master chart int i = 0; for (i = 0; i < 5; i++) { float fShapeSize = 40 + Random.Next(5); m_PointSeries.XValues.Add(Random.Next(10)); m_PointSeries.Values.Add(Random.Next(10)); m_PointSeries.FillStyles[i] = new NColorFillStyle(RandomColor()); } // create anchor panels attached to the shape series data points for (i = 0; i < m_PointSeries.Values.Count; i++) { NAnchorPanel anchorPanel = new NAnchorPanel(); m_Chart.ChildPanels.Add(anchorPanel); anchorPanel.Size = new NSizeL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); anchorPanel.Anchor = new NDataPointAnchor(m_PointSeries, i, ContentAlignment.MiddleCenter, StringAlignment.Near); anchorPanel.ContentAlignment = ContentAlignment.MiddleCenter; anchorPanel.ChildPanels.Add(CreateAnchorPanelChart()); } nChartControl1.Refresh(); }
private void UpdateMiniCharts(NChart chart) { chart.RemoveDescendantsOfType(typeof(NAnchorPanel)); chart.Series.Clear(); // add a master point series NPointSeries pointSeries = (NPointSeries)chart.Series.Add(SeriesType.Point); pointSeries.UseXValues = true; pointSeries.InflateMargins = true; pointSeries.DataLabelStyle.Visible = false; pointSeries.Size = new NLength(12, NRelativeUnit.ParentPercentage); pointSeries.FillStyle = new NColorFillStyle(Color.Gainsboro); // fill the point series with data for (int i = 0; i < 5; i++) { pointSeries.Values.Add(2 + Random.NextDouble() * 10); pointSeries.XValues.Add(2 + Random.NextDouble() * 10); } // create anchor panels attached to the point series data points for (int pointIndex = 0; pointIndex < pointSeries.Values.Count; pointIndex++) { NAnchorPanel anchorPanel = new NAnchorPanel(); chart.ChildPanels.Add(anchorPanel); anchorPanel.Size = new NSizeL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); anchorPanel.Anchor = new NDataPointAnchor(pointSeries, pointIndex, ContentAlignment.MiddleCenter, StringAlignment.Near); anchorPanel.ContentAlignment = ContentAlignment.MiddleCenter; anchorPanel.ChildPanels.Add(CreateAnchorPanelChart()); } }