private void BottomShowAtFloorCheck_CheckedChanged(object sender, System.EventArgs e) { NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryX).Stripes[0]; stripe.SetShowAtWall(ChartWallType.Floor, BottomShowAtFloorCheck.Checked); nChartControl1.Refresh(); }
private void LeftShowAtBackCheck_CheckedChanged(object sender, System.EventArgs e) { NAxisStripe stripe = (NAxisStripe)m_Chart.Axis(StandardAxis.PrimaryY).Stripes[0]; stripe.SetShowAtWall(ChartWallType.Back, LeftShowAtBackCheck.Checked); nChartControl1.Refresh(); }
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); }
public override void Initialize() { base.Initialize(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Tooltips and Cursor"); 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)); // init the values for the tooltip properties NTooltipTool tooltip = new NTooltipTool(); AutoPopDelayUpDown.Value = tooltip.AutoPopDelay; InitialDelayUpDown.Value = tooltip.InitialDelay; ReshowDelayUpDown.Value = tooltip.ReshowDelay; m_Chart = nChartControl1.Charts[0]; m_Chart.Axis(StandardAxis.Depth).Visible = false; // Add stripes for the left and the bottom axes NAxisStripe s1 = m_Chart.Axis(StandardAxis.PrimaryY).Stripes.Add(50, 60); NAxisStripe s2 = m_Chart.Axis(StandardAxis.PrimaryX).Stripes.Add(2, 3); s1.FillStyle = new NColorFillStyle(Color.CornflowerBlue); s1.SetShowAtWall(ChartWallType.Left, true); s2.FillStyle = new NColorFillStyle(Color.DarkOrange); // Create a bar series m_Bar = (NBarSeries)m_Chart.Series.Add(SeriesType.Bar); m_Bar.BarShape = BarShape.Bar; m_Bar.Legend.Mode = SeriesLegendMode.DataPoints; m_Bar.Values.Add(20.0); m_Bar.Values.Add(60.0); m_Bar.Values.Add(50.0); m_Bar.Values.Add(80.0); m_Bar.Values.Add(60.0); m_Bar.InteractivityStyles.Add(0, new NInteractivityStyle("Data item 0", CursorType.Default)); m_Bar.InteractivityStyles.Add(1, new NInteractivityStyle("Data item 1", CursorType.Default)); m_Bar.InteractivityStyles.Add(2, new NInteractivityStyle("Data item 2", CursorType.Default)); m_Bar.InteractivityStyles.Add(3, new NInteractivityStyle("Data item 3", CursorType.Default)); m_Bar.InteractivityStyles.Add(4, new NInteractivityStyle("Data item 4", CursorType.Default)); // set some fill styles in the collection. NFillStyle fillStyle; fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.Chocolate, Color.WhiteSmoke); m_Bar.FillStyles.Add(0, fillStyle); fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.Goldenrod, Color.WhiteSmoke); m_Bar.FillStyles.Add(1, fillStyle); fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.OliveDrab, Color.WhiteSmoke); m_Bar.FillStyles.Add(2, fillStyle); fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.SteelBlue, Color.WhiteSmoke); m_Bar.FillStyles.Add(3, fillStyle); fillStyle = new NGradientFillStyle(GradientStyle.DiagonalUp, GradientVariant.Variant3, Color.BlueViolet, Color.WhiteSmoke); m_Bar.FillStyles.Add(4, fillStyle); // init form controls EnableTooltipChangeCheckBox.Checked = true; CursorChangeCheckBox.Checked = true; ChartObjectComboBox.Items.Add("Background"); ChartObjectComboBox.Items.Add("Back chart wall"); ChartObjectComboBox.Items.Add("Left chart wall"); ChartObjectComboBox.Items.Add("Floor chart wall"); ChartObjectComboBox.Items.Add("Primary Y axis"); ChartObjectComboBox.Items.Add("Primary X axis"); ChartObjectComboBox.Items.Add("Horizontal stripe"); ChartObjectComboBox.Items.Add("Vertical stripe"); ChartObjectComboBox.Items.Add("Legend"); ChartObjectComboBox.Items.Add("Data item 0"); ChartObjectComboBox.Items.Add("Data item 1"); ChartObjectComboBox.Items.Add("Data item 2"); ChartObjectComboBox.Items.Add("Data item 3"); ChartObjectComboBox.Items.Add("Data item 4"); ChartObjectComboBox.SelectedIndex = 0; CursorComboBox.FillFromEnum(typeof(CursorType)); CursorComboBox.SelectedIndex = 0; }
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); WebExamplesUtilities.FillComboWithColorNames(LAColorDropDownList, KnownColor.LightSteelBlue); WebExamplesUtilities.FillComboWithColorNames(BAStripeColorDropDownList, KnownColor.LightSteelBlue); // init form controls LABeginValueDropDownList.SelectedIndex = 2; LAEndValueDropDownList.SelectedIndex = 6; BABeginValueDropDownList.SelectedIndex = 2; BAEndValueDropDownList.SelectedIndex = 6; LAShowAtBackWallCheckBox.Checked = true; LAShowAtLeftWallCheckBox.Checked = true; BAShowAtBackWallCheckBox.Checked = true; BAShowAtFloorCheckBox.Checked = true; } nChartControl1.BackgroundStyle.FrameStyle.Visible = false; // set a chart title NLabel header = nChartControl1.Labels.AddHeader("Axis Stripes"); header.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); header.TextStyle.ShadowStyle.Type = ShadowType.LinearBlur; header.ContentAlignment = ContentAlignment.BottomRight; header.Location = new NPointL( new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); NChart chart = nChartControl1.Charts[0]; chart.Enable3D = true; // set projection and lighting chart.Projection.SetPredefinedProjection(PredefinedProjection.PerspectiveTilted); chart.LightModel.SetPredefinedLightModel(PredefinedLightModel.MetallicLustre); // configure the chart margins chart.BoundsMode = BoundsMode.Fit; chart.Location = new NPointL( new NLength(10, NRelativeUnit.ParentPercentage), new NLength(15, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL( new NLength(80, NRelativeUnit.ParentPercentage), new NLength(78, NRelativeUnit.ParentPercentage)); // 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.From = LABeginValueDropDownList.SelectedIndex * 10; stripeY.To = LAEndValueDropDownList.SelectedIndex * 10; stripeY.FillStyle = new NColorFillStyle(Color.FromArgb(125, WebExamplesUtilities.ColorFromDropDownList(LAColorDropDownList))); stripeY.SetShowAtWall(ChartWallType.Back, LAShowAtBackWallCheckBox.Checked); stripeY.SetShowAtWall(ChartWallType.Left, LAShowAtLeftWallCheckBox.Checked); stripeX.From = BABeginValueDropDownList.SelectedIndex * 10; stripeX.To = BAEndValueDropDownList.SelectedIndex * 10; stripeX.FillStyle = new NColorFillStyle(Color.FromArgb(125, WebExamplesUtilities.ColorFromDropDownList(BAStripeColorDropDownList))); stripeX.SetShowAtWall(ChartWallType.Back, BAShowAtBackWallCheckBox.Checked); stripeX.SetShowAtWall(ChartWallType.Floor, BAShowAtFloorCheckBox.Checked); // Create a point series NPointSeries pnt = (NPointSeries)chart.Series.Add(SeriesType.Point); pnt.InflateMargins = true; pnt.UseXValues = true; pnt.Name = "Series 1"; pnt.DataLabelStyle.Format = "<value>"; // 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); }