protected void Page_Load(object sender, EventArgs e) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // confgigure chart nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Legend Item Text Fit Mode"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 10, 0, 10); nChartControl1.Panels.Add(title); // configure the legend NLegend legend = new NLegend(); legend.Header.Text = "Maximum Legend Item Text Size"; legend.Mode = LegendMode.Manual; legend.Data.ExpandMode = LegendExpandMode.HorzWrap; legend.DockMode = PanelDockMode.Top; legend.Margins = new NMarginsL(20, 20, 20, 20); nChartControl1.Panels.Add(legend); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // init controls if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(LegendItemTextFitModeDropDownList, typeof(LegendTextFitMode)); WebExamplesUtilities.FillComboWithValues(LegendItemMaximumWidthDropDownList, 50, 150, 50); } // Update legend items Array markShapes = Enum.GetValues(typeof(LegendMarkShape)); NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Nevron); for (int i = 0; i < markShapes.Length; i++) { NLegendItemCellData licd = new NLegendItemCellData(); LegendMarkShape markShape = (LegendMarkShape)markShapes.GetValue(i); licd.Text = "Some very long text about mark shape [" + markShape.ToString() + "]"; licd.MarkShape = markShape; licd.MarkFillStyle = new NColorFillStyle(palette.SeriesColors[i % palette.SeriesColors.Count]); licd.TextFitMode = (LegendTextFitMode)LegendItemTextFitModeDropDownList.SelectedIndex; licd.MaxTextWidth = new NLength((float)(LegendItemMaximumWidthDropDownList.SelectedIndex + 1) * 50); legend.Data.Items.Add(licd); } }
protected void Page_Load(object sender, EventArgs e) { NChart chart = nChartControl1.Charts[0]; if (!IsPostBack) { nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Dynamic Axis Range"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // no legend nChartControl1.Legends.Clear(); // setup chart chart.BoundsMode = BoundsMode.Stretch; NLineSeries line = new NLineSeries(); line.DataLabelStyle.Visible = false; line.VerticalAxisRangeMode = AxisRangeMode.ViewRange; GenerateData(line, 100.0, 100, new NRange1DD(60, 140)); chart.Series.Add(line); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); WebExamplesUtilities.FillComboWithEnumNames(VerticalAxisRangeModeDropDownList, typeof(AxisRangeMode)); VerticalAxisRangeModeDropDownList.SelectedIndex = (int)AxisRangeMode.ViewRange; int step = 10; for (int beginValue = 0; beginValue < 100; beginValue += step) { IntervalDropDownList.Items.Add(beginValue.ToString() + " - " + (beginValue + step).ToString()); } } { double start = IntervalDropDownList.SelectedIndex * 10; // assign new range chart.Axis(StandardAxis.PrimaryX).View = new NRangeAxisView(new NRange1DD(start, start + 10), true, true); // assign the range mode chart.Series[0].VerticalAxisRangeMode = (AxisRangeMode)VerticalAxisRangeModeDropDownList.SelectedIndex; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(ContourDisplayModeDropDownList, typeof(ContourDisplayMode)); WebExamplesUtilities.FillComboWithEnumNames(ContourColorModeDropDownList, typeof(ContourColorMode)); ShowFillCheckBox.Checked = true; SmoothPaletteCheckBox.Checked = true; ContourDisplayModeDropDownList.SelectedIndex = (int)ContourDisplayMode.Contour; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel title = new NLabel("Heat Map - Contour"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.DockMode = PanelDockMode.Top; title.Margins = new NMarginsL(0, 5, 0, 0); nChartControl1.Panels.Add(title); NLegend legend = new NLegend(); legend.DockMode = PanelDockMode.Right; legend.Margins = new NMarginsL(0, 5, 5, 0); legend.FitAlignment = ContentAlignment.TopCenter; nChartControl1.Panels.Add(legend); NCartesianChart chart = new NCartesianChart(); nChartControl1.Panels.Add(chart); chart.DisplayOnLegend = legend; chart.DockMode = PanelDockMode.Fill; chart.BoundsMode = BoundsMode.Stretch; chart.Margins = new NMarginsL(5); // create the heat map NHeatMapSeries heatMap = new NHeatMapSeries(); chart.Series.Add(heatMap); heatMap.Palette.Add(0.0, Color.Purple); heatMap.Palette.Add(1.5, Color.MediumSlateBlue); heatMap.Palette.Add(3.0, Color.CornflowerBlue); heatMap.Palette.Add(4.5, Color.LimeGreen); heatMap.Palette.Add(6.0, Color.LightGreen); heatMap.Palette.Add(7.5, Color.Yellow); heatMap.Palette.Add(9.0, Color.Orange); heatMap.Palette.Add(10.5, Color.Red); heatMap.XValuesMode = HeatMapValuesMode.OriginAndStep; heatMap.YValuesMode = HeatMapValuesMode.OriginAndStep; heatMap.ContourDisplayMode = ContourDisplayMode.Contour; heatMap.Legend.Mode = SeriesLegendMode.SeriesLogic; heatMap.Legend.Format = "<zone_value>"; GenerateData(heatMap); // update chart control from form controls heatMap.ContourDisplayMode = (ContourDisplayMode)ContourDisplayModeDropDownList.SelectedIndex; heatMap.ContourColorMode = (ContourColorMode)ContourColorModeDropDownList.SelectedIndex; heatMap.ShowFill = ShowFillCheckBox.Checked; heatMap.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked; if (heatMap.Palette.SmoothPalette) { heatMap.Legend.Format = "<zone_value>"; } else { heatMap.Legend.Format = "<zone_begin> - <zone_end>"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(PointShapeDropDownList, typeof(PointShape)); DifferentColorsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Ternary Point Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NTernaryChart ternaryChart = new NTernaryChart(); nChartControl1.Panels.Add(ternaryChart); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryA)); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryB)); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryC)); NTernaryPointSeries point = new NTernaryPointSeries(); ternaryChart.Series.Add(point); // setup point series point.Name = "Ternary Point Series"; point.Shape = (PointShape)PointShapeDropDownList.SelectedIndex; Random rand = new Random(); for (int i = 0; i < 20; i++) { // will be automatically normalized so that the sum of a, b, c value is 100 double aValue = rand.Next(100); double bValue = rand.Next(100); double cValue = rand.Next(100); point.AValues.Add(aValue); point.BValues.Add(bValue); point.CValues.Add(cValue); } // apply layout ApplyLayoutTemplate(0, nChartControl1, ternaryChart, title, null); if (DifferentColorsCheckBox.Checked) { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); } else { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithValues(LABeginValueDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(LAEndValueDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(BABeginValueDropDownList, 0, 100, 10); WebExamplesUtilities.FillComboWithValues(BAEndValueDropDownList, 0, 100, 10); // init form controls LABeginValueDropDownList.SelectedIndex = 2; LAEndValueDropDownList.SelectedIndex = 6; BABeginValueDropDownList.SelectedIndex = 2; BAEndValueDropDownList.SelectedIndex = 6; // init the form controls WebExamplesUtilities.FillComboWithEnumNames(LAContentAlignmentDropDownList, typeof(ContentAlignment)); LAContentAlignmentDropDownList.SelectedIndex = 0; LATextTextBox.Text = "Left Axis Line Text"; WebExamplesUtilities.FillComboWithEnumNames(BAContentAlignmentDropDownList, typeof(ContentAlignment)); BAContentAlignmentDropDownList.SelectedIndex = 0; BATextTextBox.Text = "Bottom Axis Line Text"; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Axis Stripe Labels"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; NChart chart = nChartControl1.Charts[0]; // disable the depth axis chart.Axis(StandardAxis.Depth).Visible = false; NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator; // add interlace stripe NScaleStripStyle stripStyle = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); stripStyle.Interlaced = true; stripStyle.SetShowAtWall(ChartWallType.Back, true); stripStyle.SetShowAtWall(ChartWallType.Left, true); linearScale.StripStyles.Add(stripStyle); chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = new NLinearScaleConfigurator(); // Add stripes for the left and the bottom axes NAxisStripe stripeY = chart.Axis(StandardAxis.PrimaryY).Stripes.Add(2, 3); NAxisStripe stripeX = chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3); stripeY.FillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Blue)); stripeY.From = LABeginValueDropDownList.SelectedIndex * 10; stripeY.To = LAEndValueDropDownList.SelectedIndex * 10; stripeY.SetShowAtWall(ChartWallType.Back, true); stripeY.TextAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), LAContentAlignmentDropDownList.SelectedItem.Text); stripeY.Text = LATextTextBox.Text; stripeX.FillStyle = new NColorFillStyle(Color.FromArgb(50, Color.Blue)); stripeX.From = BABeginValueDropDownList.SelectedIndex * 10; stripeX.To = BAEndValueDropDownList.SelectedIndex * 10; stripeX.SetShowAtWall(ChartWallType.Back, true); stripeX.TextAlignment = (ContentAlignment)Enum.Parse(typeof(ContentAlignment), BAContentAlignmentDropDownList.SelectedItem.Text); stripeX.Text = BATextTextBox.Text; // Create a point series NPointSeries pnt = (NPointSeries)chart.Series.Add(SeriesType.Point); pnt.InflateMargins = true; pnt.UseXValues = true; pnt.Name = "Series 1"; pnt.DataLabelStyle.Visible = false; // Add some data pnt.Values.Add(31); pnt.Values.Add(67); pnt.Values.Add(12); pnt.Values.Add(84); pnt.Values.Add(90); pnt.XValues.Add(10); pnt.XValues.Add(36); pnt.XValues.Add(52); pnt.XValues.Add(62); pnt.XValues.Add(88); // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(VerticalFillModeDropDownList, typeof(TreeMapVerticalFillMode)); VerticalFillModeDropDownList.SelectedIndex = (int)TreeMapVerticalFillMode.Default; WebExamplesUtilities.FillComboWithEnumNames(HorizontalFillModeDropDownList, typeof(TreeMapHorizontalFillMode)); HorizontalFillModeDropDownList.SelectedIndex = (int)TreeMapVerticalFillMode.Default; ColorModeDropDownList.Items.Add("Custom"); ColorModeDropDownList.Items.Add("Common Palette"); ColorModeDropDownList.Items.Add("Group Palette"); ColorModeDropDownList.SelectedIndex = 1; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = new NLabel("Tree Map"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; title.DockMode = PanelDockMode.Top; nChartControl1.Panels.Add(title); NTreeMapChart treeMap = new NTreeMapChart(); nChartControl1.Panels.Add(treeMap); treeMap.DockMode = PanelDockMode.Fill; XmlDocument document = LoadData(); foreach (XmlElement industry in document.DocumentElement) { NGroupTreeMapNode treeMapSeries = new NGroupTreeMapNode(); treeMapSeries.StrokeStyle = new NStrokeStyle(4, Color.Black); treeMapSeries.Padding = new NMarginsL(2.0f); treeMap.RootTreeMapNode.ChildNodes.Add(treeMapSeries); treeMapSeries.Label = industry.Attributes["Name"].Value; treeMapSeries.InteractivityStyle = new NInteractivityStyle(treeMapSeries.Label); foreach (XmlElement company in industry.ChildNodes) { double value = double.Parse(company.Attributes["Size"].Value); double change = double.Parse(company.Attributes["Change"].Value); string label = company.Attributes["Name"].Value; NValueTreeMapNode node = new NValueTreeMapNode(value, change, label); node.InteractivityStyle = new NInteractivityStyle(label); // node.FillStyle = new NColorFillStyle(Color.Green); treeMapSeries.ChildNodes.Add(node); } } nChartControl1.Controller.Tools.Add(new NTooltipTool()); // apply layout ApplyLayoutTemplate(0, nChartControl1, treeMap, title, null); // update from from controls treeMap.RootTreeMapNode.HorizontalFillMode = (TreeMapHorizontalFillMode)HorizontalFillModeDropDownList.SelectedIndex; treeMap.RootTreeMapNode.VerticalFillMode = (TreeMapVerticalFillMode)VerticalFillModeDropDownList.SelectedIndex; switch (ColorModeDropDownList.SelectedIndex) { case 0: { // custom color filling -> assign colors to each group (child nodes will inherit that fill) NChartPalette palette = new NChartPalette(ChartPredefinedPalette.Bright); int industryIndex = 0; foreach (NGroupTreeMapNode industryTreeMapNode in treeMap.RootTreeMapNode.ChildNodes) { foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes) { companyTreeMapNode.FillStyle = new NColorFillStyle(palette.SeriesColors[(industryIndex) % palette.SeriesColors.Count]); } industryIndex++; } } break; case 1: { // palette filling -> remove all fill styles assigned to nodes foreach (NGroupTreeMapNode industryTreeMapNode in treeMap.RootTreeMapNode.ChildNodes) { industryTreeMapNode.Palette = null; foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes) { companyTreeMapNode.FillStyle = null; } } } break; case 2: { // palette filling -> remove all fill styles assigned to nodes foreach (NGroupTreeMapNode industryTreeMapNode in treeMap.RootTreeMapNode.ChildNodes) { NPalette palette = new NPalette(); palette.Mode = PaletteMode.AutoMinMaxColor; industryTreeMapNode.Palette = palette; foreach (NTreeMapNode companyTreeMapNode in industryTreeMapNode.ChildNodes) { companyTreeMapNode.FillStyle = null; } } } break; } }
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; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(PaletteModeDropDownList, typeof(PaletteColorMode)); PaletteModeDropDownList.SelectedIndex = (int)PaletteColorMode.Spread; SmoothPaletteCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Legends[0].Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Bar Palette"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // configure the chart NChart chart = nChartControl1.Charts[0]; chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalHalf); chart.Axis(StandardAxis.Depth).Visible = false; // add interlace stripe NAxis yAxis = chart.Axis(StandardAxis.PrimaryY); NLinearScaleConfigurator linearScale = yAxis.ScaleConfigurator as NLinearScaleConfigurator; NScaleStripStyle strip = new NScaleStripStyle(new NColorFillStyle(Color.Beige), null, true, 0, 0, 1, 1); strip.Interlaced = true; strip.SetShowAtWall(ChartWallType.Back, true); linearScale.StripStyles.Add(strip); // setup a bar series NBarSeries bar = new NBarSeries(); bar.Name = "Bar Series"; bar.InflateMargins = true; bar.UseXValues = false; bar.DataLabelStyle.Visible = false; NPalette palette = new NPalette(); palette.Clear(); palette.Add(0, Color.Green); palette.Add(60, Color.Yellow); palette.Add(120, Color.Red); bar.Palette = palette; chart.Series.Add(bar); int indicatorCount = 10; // add some data to the bar series for (int i = 0; i < indicatorCount; i++) { bar.Values.Add(i * 15); } bar.PaletteColorMode = (PaletteColorMode)PaletteModeDropDownList.SelectedIndex; bar.Palette.SmoothPalette = SmoothPaletteCheckBox.Checked; // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, nChartControl1.Legends[0]); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WebExamplesUtilities.FillComboWithEnumNames(BubbleShapeDropDownList, typeof(PointShape)); DifferentColorsCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Ternary Bubble Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NTernaryChart ternaryChart = new NTernaryChart(); nChartControl1.Panels.Add(ternaryChart); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryA)); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryB)); ConfigureAxis(ternaryChart.Axis(StandardAxis.TernaryC)); // add a bubble series NTernaryBubbleSeries bubbleSeries = new NTernaryBubbleSeries(); ternaryChart.Series.Add(bubbleSeries); bubbleSeries.DataLabelStyle.VertAlign = VertAlign.Center; bubbleSeries.DataLabelStyle.Visible = false; bubbleSeries.Legend.Mode = SeriesLegendMode.DataPoints; bubbleSeries.MinSize = new NLength(2.0f, NGraphicsUnit.Point); bubbleSeries.MaxSize = new NLength(20, NGraphicsUnit.Point); bubbleSeries.Legend.Mode = SeriesLegendMode.DataPoints; bubbleSeries.Legend.Format = "<size>"; bubbleSeries.Shape = (PointShape)BubbleShapeDropDownList.SelectedIndex; Random rand = new Random(); for (int i = 0; i < 20; i++) { // will be automatically normalized so that the sum of a, b, c value is 100 double aValue = rand.Next(100); double bValue = rand.Next(100); double cValue = rand.Next(100); bubbleSeries.AValues.Add(aValue); bubbleSeries.BValues.Add(bValue); bubbleSeries.CValues.Add(cValue); bubbleSeries.Sizes.Add(10 + rand.Next(90)); } // apply layout ApplyLayoutTemplate(0, nChartControl1, ternaryChart, title, null); if (DifferentColorsCheckBox.Checked) { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.FreshMultiColor); styleSheet.Apply(nChartControl1.Document); } else { // apply style sheet NStyleSheet styleSheet = NStyleSheet.CreatePredefinedStyleSheet(PredefinedStyleSheet.Fresh); styleSheet.Apply(nChartControl1.Document); } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { NGridSurfaceSeries surface = (NGridSurfaceSeries)nChartControl1.Charts[0].Series[0]; surface.ShadingMode = SmoothShadingCheckBox.Checked ? ShadingMode.Smooth : ShadingMode.Flat; surface.FillMode = HasFillingCheckBox.Checked ? SurfaceFillMode.CustomColors : SurfaceFillMode.None; switch (FrameModeDropDownList.SelectedIndex) { case 0: // none surface.FrameMode = SurfaceFrameMode.None; break; case 1: // mesh surface.FrameMode = SurfaceFrameMode.Mesh; break; case 2: // dots surface.FrameMode = SurfaceFrameMode.Dots; break; } } else { SmoothShadingCheckBox.Checked = true; HasFillingCheckBox.Checked = true; WebExamplesUtilities.FillComboWithEnumNames(FrameModeDropDownList, typeof(SurfaceFrameMode)); FrameModeDropDownList.SelectedIndex = 0; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.Settings.ShapeRenderingMode = ShapeRenderingMode.HighSpeed; 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("Grid Surface with Custom Colors"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.TextStyle.FillStyle = new NColorFillStyle(GreyBlue); title.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; // setup chart NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; chart.Width = 60.0f; chart.Depth = 60.0f; chart.Height = 25.0f; chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.ShinyTopLeft); // setup axes 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 = new NGridSurfaceSeries(); chart.Series.Add(surface); surface.ShadingMode = ShadingMode.Smooth; surface.FillMode = SurfaceFillMode.CustomColors; surface.FrameMode = SurfaceFrameMode.None; surface.FrameColorMode = SurfaceFrameColorMode.CustomColors; surface.FrameStrokeStyle.Color = Color.Red; surface.FrameStrokeStyle.Width = new NLength(4); surface.Data.UseColors = true; surface.Data.SetGridSize(50, 50); // define a custom palette surface.Palette.Clear(); surface.Palette.Add(-3, DarkOrange); surface.Palette.Add(-2.5, LightOrange); surface.Palette.Add(-1, LightGreen); surface.Palette.Add(0, Turqoise); surface.Palette.Add(2, Blue); surface.Palette.Add(3, Purple); surface.Palette.Add(4, BeautifulRed); // generate data GenerateSurfaceData(surface); // apply layout ApplyLayoutTemplate(0, nChartControl1, chart, title, null); } }