protected void nChartControl1_AsyncCustomCommand(object sender, EventArgs e) { NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs; NCallbackCommand command = args.Command; NPieSeries pieSeries; switch (command.Name) { case "changeColor": string idText = command.Arguments["id"] as string; if (idText == null) { break; } NElementAtomIdentifier id = new NElementAtomIdentifier(idText); NChartNode node = id.FindInDocument(nChartControl1.Document) as NChartNode; if (node == null) { break; } NHitTestResult hitTestResult = new NHitTestResult(node); if (hitTestResult.ChartElement != ChartElement.DataPoint) { break; } pieSeries = hitTestResult.Series as NPieSeries; if (pieSeries == null) { break; } Color c = Color.Red; if (command.Arguments["color"].ToString() == "blue") { c = Color.Blue; } NColorFillStyle fs = pieSeries.FillStyles[hitTestResult.DataPointIndex] as NColorFillStyle; if (fs == null) { break; } pieSeries.FillStyles[hitTestResult.DataPointIndex] = new NColorFillStyle(c); clientSideRedrawRequired = (fs.Color != c); break; case "rotate10Degrees": NRootPanel rootPanel = nChartControl1.Document.RootPanel; NPieChart pieChart = nChartControl1.Charts[0] as NPieChart; pieChart.BeginAngle += 10; if (pieChart.BeginAngle >= 360) { pieChart.BeginAngle = pieChart.BeginAngle - 360; } break; } }
protected void NDrawingView1_AsyncMouseOut(object sender, EventArgs e) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; if (args.ItemId == null) { return; } NElementAtomIdentifier id = new NElementAtomIdentifier(args.ItemId); NEllipsePath path = id.FindInDocument(NDrawingView1.Document) as NEllipsePath; if (path == null) { return; } NShape shape = NSceneTree.FirstAncestor(path, NFilters.TypeNShape) as NShape; shape.Style.FillStyle = new NColorFillStyle(Color.Linen); }
protected void NDrawingView1_AsyncCustomCommand(object sender, EventArgs e) { NCallbackCustomCommandArgs args = e as NCallbackCustomCommandArgs; NCallbackCommand command = args.Command; switch (command.Name) { case "changeColor": string idText = command.Arguments["id"] as string; if (idText == null) { break; } NElementAtomIdentifier id = new NElementAtomIdentifier(idText); NEllipsePath path = id.FindInDocument(NDrawingView1.Document) as NEllipsePath; if (path == null) { break; } NShape shape = NSceneTree.FirstAncestor(path, NFilters.TypeNShape) as NShape; Color c = Color.Red; if (command.Arguments["color"].ToString() == "blue") { c = Color.Blue; } NColorFillStyle fs = shape.Style.FillStyle as NColorFillStyle; shape.Style.FillStyle = new NColorFillStyle(c); clientSideRedrawRequired = (fs == null || fs.Color != c); break; case "rotate10Degrees": IterateRotatingEllipse(true); break; } }
protected void nChartControl1_AsyncMouseOver(object sender, EventArgs e) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; if (args.ItemId == null) { return; } NElementAtomIdentifier id = new NElementAtomIdentifier(args.ItemId); NDataPoint dataPoint = id.FindInDocument(nChartControl1.Document) as NDataPoint; if (dataPoint == null) { return; } NRootPanel rootPanel = nChartControl1.Document.RootPanel; NPieSeries pieSeries = rootPanel.Charts[0].Series[0] as NPieSeries; pieSeries.FillStyles[dataPoint.IndexInSeries] = new NColorFillStyle(Color.White); }