protected override void LoadExample() { // init form members highlightFillStyle = new NColorFillStyle(Color.FromArgb(80, Color.Red)); highlightStrokeStyle = new NStrokeStyle(2, Color.Red); // begin view init view.BeginInit(); view.Grid.Visible = false; view.Selection.Mode = DiagramSelectionMode.Single; view.InteractiveAppearance.SelectedStrokeStyle = new NStrokeStyle(2, Color.Blue); view.InteractiveAppearance.SelectedFillStyle = new NColorFillStyle(Color.FromArgb(80, Color.Blue)); // init document document.BeginInit(); InitDocument(); document.EndInit(); // init form controls InitFormControls(); // end view init view.EndInit(); }
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 override void LoadExample() { // init form feilds fsNonMetals = new NColorFillStyle(Color.FromArgb(236, 97, 49)); fsMetals = new NColorFillStyle(Color.FromArgb(68, 90, 108)); fsMatalloids = new NColorFillStyle(Color.FromArgb(129, 133, 133)); fsGases = new NColorFillStyle(Color.FromArgb(247, 150, 56)); feMoccasin = new NColorFillStyle(Color.FromArgb(252, 218, 196)); feGold = new NColorFillStyle(Color.Gold); feTransitionMetals = new NColorFillStyle(Color.Pink); // begin view init view.BeginInit(); view.GlobalVisibility.ShowPorts = false; view.Grid.Visible = false; view.ViewLayout = ViewLayout.Fit; view.HorizontalRuler.Visible = false; view.VerticalRuler.Visible = false; view.DocumentPadding = new Nevron.Diagram.NMargins(10); document.BeginInit(); InitDocument(); document.EndInit(); // end view init view.EndInit(); }
private void AddDataPoints(NBubbleSeries bubble) { NChartPalette palette = new NChartPalette(); palette.SetPredefinedPalette(ChartPredefinedPalette.Dark); NColorFillStyle fs0 = new NColorFillStyle(palette.SeriesColors[0]); NColorFillStyle fs1 = new NColorFillStyle(palette.SeriesColors[1]); NColorFillStyle fs2 = new NColorFillStyle(palette.SeriesColors[2]); NColorFillStyle fs3 = new NColorFillStyle(palette.SeriesColors[3]); NColorFillStyle fs4 = new NColorFillStyle(palette.SeriesColors[4]); NColorFillStyle fs5 = new NColorFillStyle(palette.SeriesColors[5]); if (LightingFilterCheckBox.Checked) { fs0.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs1.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs2.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs3.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs4.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); fs5.ImageFiltersStyle.Filters.Add(CreateLightingImageFilter()); } bubble.AddDataPoint(new NBubbleDataPoint(27, 51, 1147995904, "India", fs0)); bubble.AddDataPoint(new NBubbleDataPoint(50, 67, 1321851888, "China", fs1)); bubble.AddDataPoint(new NBubbleDataPoint(76, 22, 109955400, "Mexico", fs2)); bubble.AddDataPoint(new NBubbleDataPoint(210, 9, 142008838, "Russia", fs3)); bubble.AddDataPoint(new NBubbleDataPoint(360, 4, 305843000, "USA", fs4)); bubble.AddDataPoint(new NBubbleDataPoint(470, 5, 33560000, "Canada", fs5)); }
protected void OnMouseEvent(string webControlId, System.Web.HttpContext context, NStateObject state, NCallbackMouseEventArgs args) { NDiagramSessionStateObject diagramState = state as NDiagramSessionStateObject; NNodeList allShapes = diagramState.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D); NNodeList affectedNodes = diagramState.HitTest(args); NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); int length; length = allShapes.Count; for (int i = 0; i < length; i++) { NShape shape = allShapes[i] as NShape; shape.Style.ShadowStyle = null; if (shape.Tag != null) { shape.Style.FillStyle = new NColorFillStyle((Color)shape.Tag); } } length = affectedShapes.Count; for (int i = 0; i < length; i++) { NShape shape = affectedShapes[i] as NShape; shape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(96, Color.Black), new NPointL(3, 3), 1, new NLength(10)); NColorFillStyle fs = shape.Style.FillStyle as NColorFillStyle; if (fs != null && fs.Color != Color.White) { shape.Tag = fs.Color; shape.Style.FillStyle = new NColorFillStyle(Color.YellowGreen); } } }
private void CreateSurface(NChart chart) { NGridSurfaceSeries surface = new NGridSurfaceSeries(); chart.Series.Add(surface); surface.Name = "Surface"; surface.FillMode = SurfaceFillMode.Uniform; surface.FrameMode = SurfaceFrameMode.None; surface.ShadingMode = ShadingMode.Smooth; surface.Data.SetGridSize(30, 30); surface.SyncPaletteWithAxisScale = false; surface.ValueFormatter.FormatSpecifier = "0.00"; Color color = Color.FromArgb(190, 130, 189); NFillStyle fillStyle = new NColorFillStyle(); NMaterialStyle material = fillStyle.MaterialStyle; material.Ambient = color; material.Diffuse = color; material.Specular = Color.FromArgb(120, 120, 120); material.Emissive = Color.Black; material.Shininess = 10; surface.FillStyle = fillStyle; FillSurfaceData(surface); }
void INAutoUpdateCallback.OnAutoUpdate(NAspNetThinWebControl control) { NThinChartControl chartControl = (NThinChartControl)control; NBarSeries bar = (NBarSeries)chartControl.Charts[0].Series[0]; int index = (int)chartControl.CustomData; for (int i = 0; i < bar.FillStyles.Count; i++) { NColorFillStyle colorFill = bar.FillStyles[i] as NColorFillStyle; if (i != index) { colorFill.Color = Color.FromArgb(60, colorFill.Color); } else { colorFill.Color = Color.FromArgb(255, colorFill.Color); } } index++; if (index >= bar.FillStyles.Count) { index = 0; } chartControl.CustomData = index; chartControl.UpdateView(); }
protected void OnMouseEvent(object sender, EventArgs e) { NCallbackMouseEventArgs args = e as NCallbackMouseEventArgs; NNodeList allShapes = NDrawingView1.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D); NNodeList affectedNodes = NDrawingView1.HitTest(args); NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); int length; length = allShapes.Count; for (int i = 0; i < length; i++) { NShape shape = allShapes[i] as NShape; shape.Style.ShadowStyle = null; if (shape.Tag != null) { shape.Style.FillStyle = new NColorFillStyle((Color)shape.Tag); } } length = affectedShapes.Count; for (int i = 0; i < length; i++) { NShape shape = affectedShapes[i] as NShape; shape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(96, Color.Black), new NPointL(3, 3), 1, new NLength(10)); NColorFillStyle fs = shape.Style.FillStyle as NColorFillStyle; if (fs != null && fs.Color != Color.White) { shape.Tag = fs.Color; shape.Style.FillStyle = new NColorFillStyle(Color.YellowGreen); } } }
public MyCustomBezierSeries(NChart chart, NCustomSeries series) { m_Chart = chart; m_Series = series; PointFill = new NColorFillStyle(Color.Red); ControlPointFill = new NColorFillStyle(Color.DarkOliveGreen); BezierStroke = new NStrokeStyle(1, Color.Indigo); TangentStroke = new NStrokeStyle(1, Color.OliveDrab); }
private void AddPieButton_Click(object sender, EventArgs e) { NChart chart = nChartControl1.Charts[0]; NPieSeries pieSeries = (NPieSeries)chart.Series[0]; double value = Convert.ToDouble(PieValueTextBox.Text); String text = "Pie " + Convert.ToString(pieSeries.Values.Count + 1); NFillStyle fill = new NColorFillStyle(WebExamplesUtilities.RandomColor()); pieSeries.AddDataPoint(new NDataPoint(value, text, fill)); }
void INMouseEventCallback.OnMouseEvent(NAspNetThinWebControl control, NBrowserMouseEventArgs e) { NThinDiagramControl diagramControl = (NThinDiagramControl)control; NNodeList allShapes = diagramControl.Document.ActiveLayer.Children(Nevron.Diagram.Filters.NFilters.Shape2D); NNodeList affectedNodes = diagramControl.HitTest(new NPointF(e.X, e.Y)); NNodeList affectedShapes = affectedNodes.Filter(Nevron.Diagram.Filters.NFilters.Shape2D); int length; bool fillChanged = false; length = allShapes.Count; for (int i = 0; i < length; i++) { NShape shape = allShapes[i] as NShape; shape.Style.ShadowStyle = null; if (shape.Tag != null) { NColorFillStyle newFill = new NColorFillStyle((Color)shape.Tag); fillChanged = fillChanged || !shape.Style.FillStyle.Equals(newFill); shape.Style.FillStyle = newFill; } } length = affectedShapes.Count; for (int i = 0; i < length; i++) { NShape shape = affectedShapes[i] as NShape; shape.Style.ShadowStyle = new NShadowStyle(ShadowType.GaussianBlur, Color.FromArgb(96, Color.Black), new NPointL(3, 3), 1, new NLength(10)); NColorFillStyle fs = shape.Style.FillStyle as NColorFillStyle; if (fs != null && fs.Color != Color.White) { shape.Tag = fs.Color; NColorFillStyle newFill = new NColorFillStyle(Color.YellowGreen); fillChanged = fillChanged || !shape.Style.FillStyle.Equals(newFill); shape.Style.FillStyle = newFill; } } if (fillChanged) { diagramControl.UpdateView(); } else { diagramControl.ClearResponse(); } }
void INAutoUpdateCallback.OnAutoUpdateStateChanged(NAspNetThinWebControl control) { // reset colors NThinChartControl chartControl = (NThinChartControl)control; NBarSeries bar = (NBarSeries)chartControl.Charts[0].Series[0]; int index = (int)chartControl.CustomData; for (int i = 0; i < bar.FillStyles.Count; i++) { NColorFillStyle colorFill = bar.FillStyles[i] as NColorFillStyle; colorFill.Color = Color.FromArgb(255, colorFill.Color); } chartControl.CustomData = 0; chartControl.UpdateView(); }
public NevronChartForm( ) { InitializeComponent(); NChart chart = this.nevronChart.Charts[0]; // setup X axis NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator(); scaleX.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); scaleX.FirstRow.UseGridStyle = true; scaleX.FirstRow.InnerTickStyle.Visible = false; scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); scaleX.SecondRow.UseGridStyle = true; scaleX.SecondRow.InnerTickStyle.Visible = false; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; scaleX.ThirdRow.InnerTickStyle.Visible = false; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; // set configurator chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.OuterMajorTickStyle.Length = new NLength(3, NGraphicsUnit.Point); scaleY.InnerMajorTickStyle.Visible = false; NFillStyle stripFill = new NColorFillStyle(Color.FromArgb(234, 233, 237)); NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; stripStyle.Interlaced = true; scaleY.StripStyles.Add(stripStyle); }
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; } }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.None; // add a trackball tool so that the user can rotate the chart nChartControl1.Controller.Tools.Clear(); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NTrackballTool()); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Surface"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.Cache = true; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 55.0f; chart.Depth = 55.0f; chart.Height = 4.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.AutoLabels = false; scaleY.MajorTickMode = MajorTickMode.AutoMaxCount; scaleY.MaxTickCount = 5; NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); ordinalScale.DisplayDataPointsBetweenTicks = false; ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); ordinalScale.DisplayDataPointsBetweenTicks = false; // add the surface series NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface); surface.Name = "Surface"; surface.FrameMode = SurfaceFrameMode.None; surface.ShadingMode = ShadingMode.Smooth; surface.AutomaticPalette = true; surface.SyncPaletteWithAxisScale = false; // NOTE: Cell triangulation mode is important for performance. Use Diagonal1 or Diagonal2 for faster rendering. surface.CellTriangulationMode = SurfaceCellTriangulationMode.Diagonal1; NColorFillStyle fill = new NColorFillStyle(); fill.MaterialStyle.Ambient = Color.FromArgb(122, 125, 110); fill.MaterialStyle.Diffuse = Color.FromArgb(122, 125, 110); fill.MaterialStyle.Specular = Color.DimGray; surface.FillStyle = fill; // apply layout ConfigureStandardLayout(chart, title, null); SurfaceSizeComboBox.Items.Add("500 x 500"); SurfaceSizeComboBox.Items.Add("1024 x 1024"); FillModeComboBox.Items.Add("Uniform"); FillModeComboBox.Items.Add("Zone Texture"); FillModeComboBox.Items.Add("Zone Texture - Smooth"); // init form controls UseHardwareAccelerationCheckBox.IsChecked = true; SurfaceSizeComboBox.SelectedIndex = 0; FillModeComboBox.SelectedIndex = 1; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Glow filter - Inner and Outer glow"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Format = "<label> X:<xvalue> Y:<value> Size:<size>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.MinSize = new NLength(10.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(20.0f, NRelativeUnit.ParentPercentage); m_Bubble.UseXValues = true; m_Bubble.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); m_GlowFilter = new NGlowImageFilter(); NFillStyle fillStyle = new NColorFillStyle(Color.Gold); fillStyle.ImageFiltersStyle.Filters.Add(m_GlowFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(10, 34, 10, "Company1", fillStyle)); fillStyle = new NColorFillStyle(Color.DarkOrange); fillStyle.ImageFiltersStyle.Filters.Add(m_GlowFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(15, 12, 20, "Company2", fillStyle)); fillStyle = new NColorFillStyle(Color.Crimson); fillStyle.ImageFiltersStyle.Filters.Add(m_GlowFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(12, 24, 25, "Company3", fillStyle)); fillStyle = new NColorFillStyle(Color.DarkOrchid); fillStyle.ImageFiltersStyle.Filters.Add(m_GlowFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(8, 56, 15, "Company4", fillStyle)); BubbleShapeCombo.SelectedIndex = 7; InflateMargins.Checked = true; m_bUpdate = true; GlowTypeComboBox.SelectedIndex = (int)m_GlowFilter.GlowType; DepthNumericUpDown.Value = (decimal)m_GlowFilter.Depth.Value; BlurTypeComboBox.SelectedIndex = (int)m_GlowFilter.BlurType; OriginalOpacityNumericUpDown.Value = (decimal)m_GlowFilter.OriginalOpacity; m_bUpdate = false; }
/// <summary> /// Called to initialize the example /// </summary> /// <param name="chartControl"></param> public override void Create() { // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stock Data Grouping"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, System.Drawing.FontStyle.Italic); // no legend nChartControl1.Legends.Clear(); // setup chart NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NRangeSelection rs = new NRangeSelection(); rs.VerticalValueSnapper = new NAxisRulerMinMaxSnapper(); chart.RangeSelections.Add(rs); // setup X axis NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator(); scaleX.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); scaleX.FirstRow.UseGridStyle = true; scaleX.FirstRow.InnerTickStyle.Visible = false; scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); scaleX.SecondRow.UseGridStyle = true; scaleX.SecondRow.InnerTickStyle.Visible = false; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; scaleX.ThirdRow.InnerTickStyle.Visible = false; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; // set configurator chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.OuterMajorTickStyle.Length = new NLength(3, NGraphicsUnit.Point); scaleY.InnerMajorTickStyle.Visible = false; NFillStyle stripFill = new NColorFillStyle(Color.FromArgb(234, 233, 237)); NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; stripStyle.Interlaced = true; scaleY.StripStyles.Add(stripStyle); // setup stock series m_Stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); m_Stock.DataLabelStyle.Visible = false; m_Stock.UpFillStyle = new NColorFillStyle(Color.White); m_Stock.UpStrokeStyle.Color = Color.Black; m_Stock.DownFillStyle = new NColorFillStyle(Color.Crimson); m_Stock.DownStrokeStyle.Color = Color.Crimson; m_Stock.HighLowStrokeStyle.Color = Color.Black; m_Stock.CandleWidth = new NLength(1.2f, NRelativeUnit.ParentPercentage); m_Stock.UseXValues = true; m_Stock.InflateMargins = true; m_Stock.DataLabelStyle.Format = "open - <open>\r\nclose - <close>"; // add some stock items const int numDataPoints = 10000; GenerateOHLCData(m_Stock, 100.0, numDataPoints, new NRange1DD(60, 140)); FillStockDates(m_Stock, numDataPoints, DateTime.Now - new TimeSpan((int)(numDataPoints * 1.2), 0, 0, 0)); nChartControl1.Controller.Tools.Add(new NPanelSelectorTool()); nChartControl1.Controller.Tools.Add(new NAxisScrollTool()); nChartControl1.Controller.Tools.Add(new NDataZoomTool()); // apply layout ConfigureStandardLayout(chart, title, null); // update form controls CustomDateTimeSpanComboBox.Items.Add("1 Week"); CustomDateTimeSpanComboBox.Items.Add("2 Weeks"); CustomDateTimeSpanComboBox.Items.Add("1 Month"); CustomDateTimeSpanComboBox.Items.Add("3 Months"); NExampleHelpers.FillComboWithEnumValues(GroupingModeComboBox, typeof(StockGroupingMode)); CustomDateTimeSpanComboBox.SelectedIndex = 2; GroupingModeComboBox.SelectedIndex = (int)StockGroupingMode.AutoDateTimeSpan; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithColorNames(UpStickColorDropDownList, KnownColor.Black); WebExamplesUtilities.FillComboWithColorNames(DownStickColorDropDownList, KnownColor.Crimson); // init form controls ShowHighLowCheckBox.Checked = true; ShowOpenCheckBox.Checked = true; ShowCloseCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stick Stock Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; // setup X axis NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator(); scaleX.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); scaleX.FirstRow.UseGridStyle = true; scaleX.FirstRow.InnerTickStyle.Visible = false; scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); scaleX.SecondRow.UseGridStyle = true; scaleX.SecondRow.InnerTickStyle.Visible = false; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; scaleX.ThirdRow.InnerTickStyle.Visible = false; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; // set configurator chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.OuterMajorTickStyle.Length = new NLength(3, NGraphicsUnit.Point); scaleY.InnerMajorTickStyle.Visible = false; NFillStyle stripFill = new NColorFillStyle(Color.FromArgb(234, 233, 237)); NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; stripStyle.Interlaced = true; scaleY.StripStyles.Add(stripStyle); // setup stock series NStockSeries stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); stock.CandleStyle = CandleStyle.Stick; stock.CandleWidth = new NLength(1.3f, NRelativeUnit.ParentPercentage); stock.DataLabelStyle.Visible = false; stock.UseXValues = true; stock.InflateMargins = true; stock.UpStrokeStyle.Width = new NLength(1, NGraphicsUnit.Point); stock.DownStrokeStyle.Width = new NLength(1, NGraphicsUnit.Point); stock.ShowClose = ShowCloseCheckBox.Checked; stock.ShowOpen = ShowOpenCheckBox.Checked; stock.ShowHighLow = ShowHighLowCheckBox.Checked; stock.UpStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(UpStickColorDropDownList); stock.DownStrokeStyle.Color = WebExamplesUtilities.ColorFromDropDownList(DownStickColorDropDownList); // add some stock items const int count = 40; GenerateOHLCData(stock, count); FillStockDates(stock, count); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FillModeDropDownList.Items.Add("Uniform"); FillModeDropDownList.Items.Add("Zone Texture"); FillModeDropDownList.Items.Add("Zone Texture - Smooth"); FillModeDropDownList.SelectedIndex = 1; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Disabled; // setup the legend NLegend legend = nChartControl1.Legends[0]; legend.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Large Surface"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 55.0f; chart.Depth = 55.0f; chart.Height = 4.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.SoftTopLeft); NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.AutoLabels = false; scaleY.MajorTickMode = MajorTickMode.AutoMaxCount; scaleY.MaxTickCount = 5; NOrdinalScaleConfigurator ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator; ordinalScale.AutoLabels = false; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); ordinalScale.DisplayDataPointsBetweenTicks = false; ordinalScale = (NOrdinalScaleConfigurator)chart.Axis(StandardAxis.Depth).ScaleConfigurator; ordinalScale.AutoLabels = false; ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Floor, true); ordinalScale.MajorGridStyle.SetShowAtWall(ChartWallType.Left, true); ordinalScale.DisplayDataPointsBetweenTicks = false; // add the surface series NGridSurfaceSeries surface = (NGridSurfaceSeries)chart.Series.Add(SeriesType.GridSurface); surface.Name = "Surface"; surface.FrameMode = SurfaceFrameMode.None; surface.FillMode = SurfaceFillMode.Uniform; surface.PositionValue = 10.0; surface.ShadingMode = ShadingMode.Smooth; surface.CellTriangulationMode = SurfaceCellTriangulationMode.Diagonal1; NColorFillStyle fill = new NColorFillStyle(); fill.MaterialStyle.Ambient = Color.FromArgb(100, 100, 90); fill.MaterialStyle.Diffuse = Color.FromArgb(100, 100, 90); fill.MaterialStyle.Specular = Color.DimGray; surface.FillStyle = fill; using (Bitmap bitmap = new Bitmap(this.MapPathSecure("~\\Images\\HeightMap0500.png"))) { surface.Data.InitFromBitmap(bitmap); } // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); switch (FillModeDropDownList.SelectedIndex) { case 0: surface.FillMode = SurfaceFillMode.Uniform; break; case 1: surface.FillMode = SurfaceFillMode.ZoneTexture; surface.SmoothPalette = false; surface.PaletteSteps = 8; break; case 2: surface.FillMode = SurfaceFillMode.ZoneTexture; surface.SmoothPalette = true; surface.PaletteSteps = 7; break; } }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Stick Stock Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); // no legend nChartControl1.Legends.Clear(); // setup chart NChart chart = nChartControl1.Charts[0]; // setup X axis NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator(); scaleX.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); scaleX.FirstRow.UseGridStyle = true; scaleX.FirstRow.InnerTickStyle.Visible = false; scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); scaleX.SecondRow.UseGridStyle = true; scaleX.SecondRow.InnerTickStyle.Visible = false; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; scaleX.ThirdRow.InnerTickStyle.Visible = false; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; // set configurator chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.OuterMajorTickStyle.Length = new NLength(3, NGraphicsUnit.Point); scaleY.InnerMajorTickStyle.Visible = false; NFillStyle stripFill = new NColorFillStyle(Color.FromArgb(234, 233, 237)); NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; stripStyle.Interlaced = true; scaleY.StripStyles.Add(stripStyle); // add a stock series m_Stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); m_Stock.CandleStyle = CandleStyle.Stick; m_Stock.DataLabelStyle.Visible = false; m_Stock.UpStrokeStyle.Width = new NLength(1, NGraphicsUnit.Point); m_Stock.UpStrokeStyle.Color = Color.Black; m_Stock.DownStrokeStyle.Width = new NLength(1, NGraphicsUnit.Point); m_Stock.DownStrokeStyle.Color = Color.Crimson; m_Stock.CandleWidth = new NLength(1.3f, NRelativeUnit.ParentPercentage); m_Stock.UseXValues = true; m_Stock.InflateMargins = true; // add some stock items const int count = 50; GenerateOHLCData(m_Stock, 100.0, count, new NRange1DD(60, 140)); FillStockDates(m_Stock, count); // apply layout ConfigureStandardLayout(chart, title, null); // init form controls ShowHighLow.Checked = true; ShowOpen.Checked = true; ShowClose.Checked = true; }
public override void Initialize() { base.Initialize(); nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Exploded Pie Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NChart chart = new NPieChart(); nChartControl1.Panels.Add(chart); chart.Enable3D = true; chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalElevated); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); chart.Size = new NSizeL(new NLength(60, NRelativeUnit.ParentPercentage), new NLength(60, NRelativeUnit.ParentPercentage)); chart.Location = new NPointL(new NLength(20, NRelativeUnit.ParentPercentage), new NLength(20, NRelativeUnit.ParentPercentage)); m_Pie = (NPieSeries)chart.Series.Add(SeriesType.Pie); m_Pie.PieEdgePercent = 30; m_Pie.AddDataPoint(new NDataPoint(12, "Cars")); m_Pie.AddDataPoint(new NDataPoint(42, "Trains")); m_Pie.AddDataPoint(new NDataPoint(56, "Airplanes")); m_Pie.AddDataPoint(new NDataPoint(23, "Buses")); for (int i = 0; i < m_Pie.Values.Count; i++) { m_Pie.Detachments.Add(0); } m_DefaultFillStyles = new NFillStyle[4]; NChartPalette palette = new NChartPalette(); palette.SetPredefinedPalette(ChartPredefinedPalette.Winter); m_DefaultFillStyles[0] = new NColorFillStyle(palette.SeriesColors[0]); m_DefaultFillStyles[1] = new NColorFillStyle(palette.SeriesColors[1]); m_DefaultFillStyles[2] = new NColorFillStyle(palette.SeriesColors[2]); m_DefaultFillStyles[3] = new NColorFillStyle(palette.SeriesColors[3]); for (int i = 0; i < m_DefaultFillStyles.Length; i++) { m_Pie.FillStyles[i] = m_DefaultFillStyles[i]; } SetPieDefaultFillStyles(); m_Pie.PieStyle = PieStyle.SmoothEdgePie; m_Pie.Legend.Mode = SeriesLegendMode.DataPoints; m_Pie.Legend.Format = "<label> <percent>"; // subscribe for control events nChartControl1.MouseDown += new MouseEventHandler(ChartControl_MouseDown); nChartControl1.MouseMove += new MouseEventHandler(ChartControl_MouseMove); }
protected void CreateElements(NDrawingDocument document) { NFillStyle fsNonMetals = new NColorFillStyle(Color.FromArgb(205, 153, 255)); NFillStyle fsMetals = new NColorFillStyle(Color.FromArgb(155, 207, 255)); NFillStyle fsMatalloids = new NColorFillStyle(Color.FromArgb(48, 198, 187)); NFillStyle fsGases = new NColorFillStyle(Color.FromArgb(153, 198, 17)); NFillStyle feMoccasin = new NColorFillStyle(Color.FromArgb(255, 204, 157)); NFillStyle feGold = new NColorFillStyle(Color.FromArgb(253, 205, 0)); NFillStyle feCentralGroup = new NColorFillStyle(Color.FromArgb(255, 154, 204)); document.Style.TextStyle.TextFormat = TextFormat.XML; NChemicalElement[] elements = { // row 1 new NChemicalElement(1, "H", "1.01", 1, 1, fsNonMetals), new NChemicalElement(2, "He", "4.00", 18, 1, fsGases), // row 2 new NChemicalElement(3, "Li", "6.94", 1, 2, fsMetals), new NChemicalElement(4, "Be", "9.01", 2, 2, fsMetals), new NChemicalElement(5, "B", "10.81", 13, 2, fsNonMetals), new NChemicalElement(6, "C", "12.01", 14, 2, fsNonMetals), new NChemicalElement(7, "N", "14.01", 15, 2, fsNonMetals), new NChemicalElement(8, "O", "15.99", 16, 2, fsNonMetals), new NChemicalElement(9, "F", "19.00", 17, 2, fsNonMetals), new NChemicalElement(10, "Ne", "20.18", 18, 2, fsGases), // row 3 new NChemicalElement(11, "Na", "22.99", 1, 3, fsMetals), new NChemicalElement(12, "Mg", "25.31", 2, 3, fsMetals), new NChemicalElement(13, "Al", "26.98", 13, 3, fsMetals), new NChemicalElement(14, "Si", "28.09", 14, 3, fsMatalloids), new NChemicalElement(15, "P", "30.97", 15, 3, fsMatalloids), new NChemicalElement(16, "S", "32.07", 16, 3, fsNonMetals), new NChemicalElement(17, "Cl", "35.45", 17, 3, fsNonMetals), new NChemicalElement(18, "Ar", "39.95", 18, 3, fsGases), // row 4 new NChemicalElement(19, "K", "39.10", 1, 4, fsMetals), new NChemicalElement(20, "Ca", "40.08", 2, 4, fsMetals), new NChemicalElement(21, "Sc", "44.96", 3, 4, feCentralGroup), new NChemicalElement(22, "Ti", "47.87", 4, 4, feCentralGroup), new NChemicalElement(23, "V", "50.94", 5, 4, feCentralGroup), new NChemicalElement(24, "Cr", "52.00", 6, 4, feCentralGroup), new NChemicalElement(25, "Mn", "54.94", 7, 4, feCentralGroup), new NChemicalElement(26, "Fe", "55.85", 8, 4, feCentralGroup), new NChemicalElement(27, "Co", "58.93", 9, 4, feCentralGroup), new NChemicalElement(28, "Ni", "58.69", 10, 4, feCentralGroup), new NChemicalElement(29, "Cu", "63.55", 11, 4, feCentralGroup), new NChemicalElement(30, "Zn", "65.41", 12, 4, feCentralGroup), new NChemicalElement(31, "Ga", "69.72", 13, 4, fsMetals), new NChemicalElement(32, "Ge", "72.64", 14, 4, fsMatalloids), new NChemicalElement(33, "As", "74.92", 15, 4, fsMatalloids), new NChemicalElement(34, "Se", "78.96", 16, 4, fsNonMetals), new NChemicalElement(35, "Br", "79.90", 17, 4, fsNonMetals), new NChemicalElement(36, "Kr", "83.80", 18, 4, fsGases), // row 5 new NChemicalElement(37, "Rb", "85.47", 1, 5, fsMetals), new NChemicalElement(38, "Sr", "87.62", 2, 5, fsMetals), new NChemicalElement(39, "Y", "88.91", 3, 5, feCentralGroup), new NChemicalElement(40, "Zr", "91.22", 4, 5, feCentralGroup), new NChemicalElement(41, "Nb", "92.91", 5, 5, feCentralGroup), new NChemicalElement(42, "Mo", "95.94", 6, 5, feCentralGroup), new NChemicalElement(43, "Tc", "(98)", 7, 5, feCentralGroup), new NChemicalElement(44, "Ru", "101.07", 8, 5, feCentralGroup), new NChemicalElement(45, "Rh", "102.91", 9, 5, feCentralGroup), new NChemicalElement(46, "Pd", "106.42", 10, 5, feCentralGroup), new NChemicalElement(47, "Ag", "107.87", 11, 5, feCentralGroup), new NChemicalElement(48, "Cd", "112.41", 12, 5, feCentralGroup), new NChemicalElement(49, "In", "114.82", 13, 5, fsMetals), new NChemicalElement(50, "Sn", "118.71", 14, 5, fsMetals), new NChemicalElement(51, "Sb", "121.76", 15, 5, fsMatalloids), new NChemicalElement(52, "Te", "127.60", 16, 5, fsMatalloids), new NChemicalElement(53, "I", "126.90", 17, 5, fsNonMetals), new NChemicalElement(54, "Xe", "131.29", 18, 5, fsGases), // row 6 new NChemicalElement(55, "Cs", "132.91", 1, 6, fsMetals), new NChemicalElement(56, "Ba", "137.33", 2, 6, fsMetals), new NChemicalElement(57, "*La", "138.91", 3, 6, feCentralGroup), new NChemicalElement(72, "Hf", "178.49", 4, 6, feCentralGroup), new NChemicalElement(73, "Ta", "180.95", 5, 6, feCentralGroup), new NChemicalElement(74, "W", "183.84", 6, 6, feCentralGroup), new NChemicalElement(75, "Re", "186.21", 7, 6, feCentralGroup), new NChemicalElement(76, "Os", "190.23", 8, 6, feCentralGroup), new NChemicalElement(77, "Ir", "192.22", 9, 6, feCentralGroup), new NChemicalElement(78, "Pt", "195.08", 10, 6, feCentralGroup), new NChemicalElement(79, "Au", "196.97", 11, 6, feCentralGroup), new NChemicalElement(80, "Hg", "200.59", 12, 6, feCentralGroup), new NChemicalElement(81, "Tl", "204.38", 13, 6, fsMetals), new NChemicalElement(82, "Pb", "207.2", 14, 6, fsMetals), new NChemicalElement(83, "Bi", "208.98", 15, 6, fsMetals), new NChemicalElement(84, "Po", "(209)", 16, 6, fsMetals), new NChemicalElement(85, "At", "(210)", 17, 6, fsNonMetals), new NChemicalElement(86, "Rn", "(222)", 18, 6, fsGases), // row 7 new NChemicalElement(87, "Fr", "(223)", 1, 7, fsMetals), new NChemicalElement(88, "Ra", "(226)", 2, 7, fsMetals), new NChemicalElement(89, "*Ac", "(227)", 3, 7, feCentralGroup), new NChemicalElement(104, "Rf", "(261)", 4, 7, feCentralGroup), new NChemicalElement(105, "Db", "(262)", 5, 7, feCentralGroup), new NChemicalElement(106, "Sg", "(266)", 6, 7, feCentralGroup), new NChemicalElement(107, "Bh", "(264)", 7, 7, feCentralGroup), new NChemicalElement(108, "Hs", "(270)", 8, 7, feCentralGroup), new NChemicalElement(109, "Mt", "(268)", 9, 7, feCentralGroup), new NChemicalElement(110, "Ds", "(281)", 10, 7, feCentralGroup), new NChemicalElement(111, "Rg", "(272)", 11, 7, feCentralGroup), // row 8 // row 9 new NChemicalElement(58, "Ce", "140.12", 5, 9, feMoccasin), new NChemicalElement(59, "Pr", "140.91", 6, 9, feMoccasin), new NChemicalElement(60, "Nd", "144.24", 7, 9, feMoccasin), new NChemicalElement(61, "Pm", "(145)", 8, 9, feMoccasin), new NChemicalElement(62, "Sm", "150.36", 9, 9, feMoccasin), new NChemicalElement(63, "Eu", "151.97", 10, 9, feMoccasin), new NChemicalElement(64, "Gd", "157.25", 11, 9, feMoccasin), new NChemicalElement(65, "Tb", "158.93", 12, 9, feMoccasin), new NChemicalElement(66, "Dy", "162.50", 13, 9, feMoccasin), new NChemicalElement(67, "Ho", "164.93", 14, 9, feMoccasin), new NChemicalElement(68, "Er", "167.26", 15, 9, feMoccasin), new NChemicalElement(69, "Tm", "168.93", 16, 9, feMoccasin), new NChemicalElement(70, "Yb", "173.04", 17, 9, feMoccasin), new NChemicalElement(71, "Lu", "174.97", 18, 9, feMoccasin), // row 10 new NChemicalElement(90, "Th", "232.04", 5, 10, feGold), new NChemicalElement(91, "Pa", "231.04", 6, 10, feGold), new NChemicalElement(92, "U", "238.03", 7, 10, feGold), new NChemicalElement(93, "Np", "(237)", 8, 10, feGold), new NChemicalElement(94, "Pu", "(244)", 9, 10, feGold), new NChemicalElement(95, "Am", "(243)", 10, 10, feGold), new NChemicalElement(96, "Cm", "(247)", 11, 10, feGold), new NChemicalElement(97, "Bk", "(247)", 12, 10, feGold), new NChemicalElement(98, "Cf", "(251)", 13, 10, feGold), new NChemicalElement(99, "Es", "(252)", 14, 10, feGold), new NChemicalElement(100, "Fm", "(257)", 15, 10, feGold), new NChemicalElement(101, "Md", "(258)", 16, 10, feGold), new NChemicalElement(102, "No", "(259)", 17, 10, feGold), new NChemicalElement(103, "Lr", "(262)", 18, 10, feGold), }; int length = elements.Length; for (int i = 0; i < length; i++) { AddElement(document, elements[i]); } }
protected void Page_Load(object sender, EventArgs e) { NStockSeries stock; if (!IsPostBack) { // set a chart title nChartControl1.BackgroundStyle.FrameStyle.Visible = false; NLabel title = nChartControl1.Labels.AddHeader("Stock Data Grouping"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart NCartesianChart chart = (NCartesianChart)nChartControl1.Charts[0]; chart.BoundsMode = BoundsMode.Stretch; NRangeSelection rs = new NRangeSelection(); rs.VerticalValueSnapper = new NAxisRulerMinMaxSnapper(); chart.RangeSelections.Add(rs); // setup X axis NValueTimelineScaleConfigurator scaleX = new NValueTimelineScaleConfigurator(); scaleX.FirstRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.FirstRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(225, 225, 225)); scaleX.FirstRow.UseGridStyle = true; scaleX.FirstRow.InnerTickStyle.Visible = false; scaleX.SecondRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.SecondRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(215, 215, 215)); scaleX.SecondRow.UseGridStyle = true; scaleX.SecondRow.InnerTickStyle.Visible = false; scaleX.ThirdRow.GridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; scaleX.ThirdRow.GridStyle.LineStyle = new NStrokeStyle(1, Color.FromArgb(205, 205, 205)); scaleX.ThirdRow.UseGridStyle = true; scaleX.ThirdRow.InnerTickStyle.Visible = false; // calendar NWeekDayRule wdr = new NWeekDayRule(WeekDayBit.All); wdr.Saturday = false; wdr.Sunday = false; scaleX.Calendar.Rules.Add(wdr); scaleX.EnableCalendar = true; // set configurator chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = scaleX; chart.Axis(StandardAxis.PrimaryX).ScrollBar.Visible = true; // setup Y axis NLinearScaleConfigurator scaleY = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; scaleY.OuterMajorTickStyle.Length = new NLength(3, NGraphicsUnit.Point); scaleY.InnerMajorTickStyle.Visible = false; NFillStyle stripFill = new NColorFillStyle(Color.FromArgb(234, 233, 237)); NScaleStripStyle stripStyle = new NScaleStripStyle(stripFill, null, true, 1, 0, 1, 1); stripStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back }; stripStyle.Interlaced = true; scaleY.StripStyles.Add(stripStyle); // setup stock series stock = (NStockSeries)chart.Series.Add(SeriesType.Stock); stock.DataLabelStyle.Visible = false; stock.UpFillStyle = new NColorFillStyle(Color.White); stock.UpStrokeStyle.Color = Color.Black; stock.DownFillStyle = new NColorFillStyle(Color.Crimson); stock.DownStrokeStyle.Color = Color.Crimson; stock.HighLowStrokeStyle.Color = Color.Black; stock.CandleWidth = new NLength(1.2f, NRelativeUnit.ParentPercentage); stock.UseXValues = true; stock.InflateMargins = true; stock.DataLabelStyle.Format = "open - <open>\r\nclose - <close>"; // add some stock items const int numDataPoints = 1000; WebExamplesUtilities.GenerateOHLCData(stock, 100.0, numDataPoints, new NRange1DD(60, 140)); FillStockDates(stock, numDataPoints, DateTime.Now - new TimeSpan((int)(numDataPoints * 1.2), 0, 0, 0)); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); // update form controls CustomDateTimeSpanDropDownList.Items.Add("1 Week"); CustomDateTimeSpanDropDownList.Items.Add("2 Weeks"); CustomDateTimeSpanDropDownList.Items.Add("1 Month"); CustomDateTimeSpanDropDownList.Items.Add("3 Months"); WebExamplesUtilities.FillComboWithEnumNames(GroupingModeDropDownList, typeof(StockGroupingMode)); CustomDateTimeSpanDropDownList.SelectedIndex = 2; GroupingModeDropDownList.SelectedIndex = (int)StockGroupingMode.SynchronizeWithMajorTick; WebExamplesUtilities.FillComboWithPercents(GroupPercendWidthDropDownList, 10); GroupPercendWidthDropDownList.SelectedIndex = 2; WebExamplesUtilities.FillComboWithValues(MinGroupDistanceDropDownList, 2, 20, 2); MinGroupDistanceDropDownList.SelectedIndex = 2; } else { stock = (NStockSeries)nChartControl1.Charts[0].Series[0]; } MinGroupDistanceDropDownList.Enabled = false; CustomDateTimeSpanDropDownList.Enabled = false; GroupPercendWidthDropDownList.Enabled = true; switch (GroupingModeDropDownList.SelectedIndex) { case (int)StockGroupingMode.None: stock.GroupingMode = StockGroupingMode.None; GroupPercendWidthDropDownList.Enabled = false; break; case (int)StockGroupingMode.AutoDateTimeSpan: stock.GroupingMode = StockGroupingMode.AutoDateTimeSpan; MinGroupDistanceDropDownList.Enabled = true; break; case (int)StockGroupingMode.CustomDateTimeSpan: stock.GroupingMode = StockGroupingMode.CustomDateTimeSpan; CustomDateTimeSpanDropDownList.Enabled = true; break; case (int)StockGroupingMode.SynchronizeWithMajorTick: stock.GroupingMode = StockGroupingMode.SynchronizeWithMajorTick; break; default: break; } stock.MinAutoGroupLength = new NLength((float)MinGroupDistanceDropDownList.SelectedIndex * 2 + 2, NGraphicsUnit.Point); switch (CustomDateTimeSpanDropDownList.SelectedIndex) { case 0: // 1 Week stock.CustomGroupStep = new NDateTimeSpan(1, NDateTimeUnit.Week); break; case 1: // 2 Weeks stock.CustomGroupStep = new NDateTimeSpan(2, NDateTimeUnit.Week); break; case 2: // 1 Month stock.CustomGroupStep = new NDateTimeSpan(1, NDateTimeUnit.Month); break; case 3: // 3 Months stock.CustomGroupStep = new NDateTimeSpan(3, NDateTimeUnit.Month); break; } stock.GroupPercentWidth = (float)GroupPercendWidthDropDownList.SelectedIndex * 10; }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Lighting Filter"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.ContentAlignment = ContentAlignment.BottomCenter; title.Location = new NPointL(new NLength(50, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // setup chart m_Chart = nChartControl1.Charts[0]; m_Chart.Projection.SetPredefinedProjection(PredefinedProjection.Orthogonal); m_Chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale = new NLinearScaleConfigurator(); m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = linearScale; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Back, true); m_Bubble = (NBubbleSeries)m_Chart.Series.Add(SeriesType.Bubble); m_Bubble.DataLabelStyle.Visible = false; m_Bubble.Legend.Format = "<label> X:<xvalue> Y:<value> Size:<size>"; m_Bubble.Legend.Mode = SeriesLegendMode.DataPoints; m_Bubble.MinSize = new NLength(10.0f, NRelativeUnit.ParentPercentage); m_Bubble.MaxSize = new NLength(20.0f, NRelativeUnit.ParentPercentage); m_Bubble.UseXValues = true; m_Bubble.ShadowStyle.Type = ShadowType.Solid; m_Bubble.ShadowStyle.Offset = new NPointL(3, 3); m_Bubble.ShadowStyle.Color = Color.FromArgb(60, 0, 0, 0); m_Bubble.BorderStyle.Width = new NLength(0, NGraphicsUnit.Pixel); m_Bubble.InflateMargins = true; m_LightingFilter = new NLightingImageFilter(); NFillStyle fillStyle = new NColorFillStyle(Color.Gold); fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(10, 34, 10, "Company1", fillStyle)); fillStyle = new NColorFillStyle(Color.DarkOrange); fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(15, 12, 20, "Company2", fillStyle)); fillStyle = new NColorFillStyle(Color.Crimson); fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(12, 24, 25, "Company3", fillStyle)); fillStyle = new NColorFillStyle(Color.DarkOrchid); fillStyle.ImageFiltersStyle.Filters.Add(m_LightingFilter); m_Bubble.AddDataPoint(new NBubbleDataPoint(8, 56, 15, "Company4", fillStyle)); BubbleShapeCombo.FillFromEnum(typeof(PointShape)); BubbleShapeCombo.SelectedIndex = 7; InflateMargins.Checked = true; LightSourceTypeComboBox.FillFromEnum(typeof(LightSourceType)); BlurTypeComboBox.FillFromEnum(typeof(BlurType)); BevelDepthNumericUpDown.Value = (decimal)m_LightingFilter.BevelDepth.Value; BlurTypeComboBox.SelectedIndex = (int)m_LightingFilter.BlurType; SurfaceScaleNumericUpDown.Value = (decimal)m_LightingFilter.SurfaceScale; ShininessNumericUpDown.Value = (decimal)m_LightingFilter.Shininess; LightSourceTypeComboBox.SelectedIndex = (int)m_LightingFilter.LightSourceType; NVector3DF vector = m_LightingFilter.Position; PositionXnumericUpDown.Value = (decimal)vector.X; PositionYnumericUpDown.Value = (decimal)vector.Y; PositionZnumericUpDown.Value = (decimal)vector.Z; m_Updating = false; }
protected NCompositeShape CreateOrgChartShape(NPersonalInfo info) { NRectangleF bounds = info.Bounds; float bottomPortAlignment = info.BottomPortAlignment; Bitmap photo = new Bitmap(this.MapPathSecure(info.Picture)); // compose a new graph vertex from a frame and an image NRectanglePath frame = new NRectanglePath(bounds); NRectanglePath image = new NRectanglePath(new NPointF(bounds.X + 5, bounds.Y + 5), new NSizeF(photo.Size)); NImageFillStyle imgageFillStyle = new NImageFillStyle(photo, 0xff); NStyle.SetFillStyle(image, imgageFillStyle); NCompositeShape shape = new NCompositeShape(); shape.Primitives.AddChild(frame); shape.Primitives.AddChild(image); shape.UpdateModelBounds(); Document.ActiveLayer.AddChild(shape); // set the vertex fill style NColorFillStyle fillStyle = null; switch (info.Level) { case 0: fillStyle = new NColorFillStyle(Color.FromArgb(241, 100, 34)); break; case 1: fillStyle = new NColorFillStyle(Color.FromArgb(249, 167, 26)); break; case 2: fillStyle = new NColorFillStyle(Color.FromArgb(255, 247, 151)); break; } fillStyle.ImageFiltersStyle.Filters.Add(new NLightingImageFilter()); shape.Style.FillStyle = fillStyle; NInteractivityStyle interactivityStyle = new NInteractivityStyle(); interactivityStyle.Tooltip.Text = "Click to show " + info.Name + " personal information"; interactivityStyle.UrlLink.Url = "../Examples/WebControl/GettingStarted/NPersonalInfoPage.aspx?" + info.Id.ToString(); shape.Style.InteractivityStyle = interactivityStyle; // add a new label for the person name NRotatedBoundsLabel nameLabel = new NRotatedBoundsLabel(info.Name, shape.UniqueId, new Nevron.Diagram.NMargins(40, 1, 50, 1)); shape.Labels.AddChild(nameLabel); NStyle.SetTextStyle(nameLabel, nameLabel.ComposeTextStyle().Clone() as NTextStyle); nameLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right; nameLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Top; // configure default label (used for the person position) NRotatedBoundsLabel positionLabel = shape.Labels.DefaultLabel as NRotatedBoundsLabel; NStyle.SetTextStyle(positionLabel, positionLabel.ComposeTextStyle().Clone() as NTextStyle); positionLabel.Style.TextStyle.FontStyle.InitFromFont(new Font("Arial", 10, FontStyle.Bold)); positionLabel.Style.TextStyle.StringFormatStyle.HorzAlign = HorzAlign.Right; positionLabel.Style.TextStyle.StringFormatStyle.VertAlign = VertAlign.Bottom; positionLabel.Margins = new Nevron.Diagram.NMargins(40, 5, 1, 50); positionLabel.Text = info.Position; // create the optional ports of the shape shape.CreateShapeElements(ShapeElementsMask.Ports); // add rotated bounds ports NPort leftPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleLeft)); leftPort.Name = "Left"; shape.Ports.AddChild(leftPort); NPort rightPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.MiddleRight)); rightPort.Name = "Right"; shape.Ports.AddChild(rightPort); NPort topPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(ContentAlignment.TopCenter)); topPort.Name = "Top"; shape.Ports.AddChild(topPort); NRotatedBoundsPort bottomPort = new NRotatedBoundsPort(shape.UniqueId, new NContentAlignment(bottomPortAlignment, 50)); bottomPort.Name = "Bottom"; shape.Ports.AddChild(bottomPort); return(shape); }