private void ExplodePieSegment(NStateObject state, EventArgs e, int offset) { // this method is called when the web control operates in the Nevron Instant Callback mode NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NChartSessionStateObject chartState = state as NChartSessionStateObject; NHitTestResult result = chartState.HitTest(args); NRootPanel rootPanel = chartState.Document.RootPanel; if (result.ChartElement == ChartElement.DataPoint) { NPieSeries pieSeries = result.Series as NPieSeries; pieSeries.Detachments.Clear(); for (int i = 0; i < pieSeries.Values.Count; i++) { if (i == result.DataPointIndex) { pieSeries.Detachments.Add(offset); } else { pieSeries.Detachments.Add(0); } } } }
private void ColorPieSegment(NStateObject state, EventArgs e, Color c) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NChartSessionStateObject chartState = state as NChartSessionStateObject; NHitTestResult result = chartState.HitTest(args); NRootPanel rootPanel = chartState.Document.RootPanel; if (result.ChartElement == ChartElement.DataPoint) { NPieSeries pieSeries = result.Series as NPieSeries; for (int i = 0; i < pieSeries.Values.Count; i++) { if (i == result.DataPointIndex) { pieSeries.FillStyles[i] = new NColorFillStyle(c); pieSeries.BorderStyles[i] = new NStrokeStyle(1, Color.White); } else { int colorIndex = i % NExampleUC.arrCustomColors2.Length; Color color = NExampleUC.arrCustomColors2[colorIndex]; pieSeries.FillStyles[i] = new NColorFillStyle(color); pieSeries.BorderStyles[i] = new NStrokeStyle(1, color); } } } }
private void ExplodePieSegment(NStateObject state, EventArgs e, int offset) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NChartSessionStateObject chartState = state as NChartSessionStateObject; NHitTestResult result = chartState.HitTest(args); if (result.ChartElement == ChartElement.DataPoint) { NPieSeries pieSeries = result.Series as NPieSeries; pieSeries.Detachments.Clear(); for (int i = 0; i < pieSeries.Values.Count; i++) { if (i == result.DataPointIndex) { pieSeries.Detachments.Add(offset); } else { pieSeries.Detachments.Add(0); } } } }
private void ProcessMouseEvent(NStateObject state, EventArgs e, Color c) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NChartSessionStateObject chartState = state as NChartSessionStateObject; NHitTestResult result = chartState.HitTest(args); NRootPanel rootPanel = chartState.Document.RootPanel; if (result.ChartElement == ChartElement.DataPoint) { switch (result.Chart.Tag.ToString()) { case "BarChart": NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Nevron); Color highlightColor = palette.SeriesColors[5]; NBarSeries barSeries = result.Series as NBarSeries; foreach (NBarSeries series in rootPanel.Charts[0].Series) { series.FillStyles.Clear(); series.BorderStyles.Clear(); } barSeries.FillStyles[result.DataPointIndex] = new NColorFillStyle(c); barSeries.BorderStyles[result.DataPointIndex] = new NStrokeStyle(1, c); int nCount = rootPanel.ChildPanels.Count; for (int i = 0; i < nCount; i++) { if (rootPanel.ChildPanels[i] is NRoundedRectangularCallout) { rootPanel.ChildPanels.RemoveAt(i); } } NRoundedRectangularCallout m_RoundedRectangularCallout = new NRoundedRectangularCallout(); m_RoundedRectangularCallout.ArrowLength = new NLength(10, NRelativeUnit.ParentPercentage); m_RoundedRectangularCallout.FillStyle = new NGradientFillStyle(Color.FromArgb(255, Color.White), Color.FromArgb(125, highlightColor)); m_RoundedRectangularCallout.UseAutomaticSize = true; m_RoundedRectangularCallout.Orientation = 45; m_RoundedRectangularCallout.Anchor = new NDataPointAnchor(barSeries, result.DataPointIndex, ContentAlignment.TopRight, StringAlignment.Center); m_RoundedRectangularCallout.Text = ((NDataPoint)result.Object)[DataPointValue.Y].ToString(); rootPanel.ChildPanels.Add(m_RoundedRectangularCallout); break; case "PieChart": NPieSeries pieSeries = result.Series as NPieSeries; pieSeries.Detachments.Clear(); for (int i = 0; i < pieSeries.Values.Count; i++) { if (i == result.DataPointIndex) { pieSeries.Detachments.Add(15); } else { pieSeries.Detachments.Add(0); } } break; } } }