private void LegendWidthNumericUpDown_ValueChanged(object sender, EventArgs e) { if (m_Legend == null) { return; } NLength legendWidth = new NLength((float)LegendWidthNumericUpDown.Value, NRelativeUnit.ParentPercentage); NLength chartWidth = new NLength(100 - (float)LegendWidthNumericUpDown.Value, NRelativeUnit.ParentPercentage); m_Legend.Size = new NSizeL(legendWidth, m_Legend.Size.Height); m_Legend.Location = new NPointL(chartWidth, m_Legend.Location.Y); m_Chart.Size = new NSizeL(chartWidth, m_Chart.Size.Height); nChartControl1.Refresh(); }
private void CellSizeComboBox_SelectedIndexChanged(object sender, System.EventArgs e) { NLength segmentWidth = new NLength(0); NLength segmentGap = new NLength(0); NSizeL cellSize = new NSizeL(new NLength(0), new NLength(0)); switch (CellSizeComboBox.SelectedIndex) { case 0: // small segmentWidth = new NLength(2, NGraphicsUnit.Point); segmentGap = new NLength(1, NGraphicsUnit.Point); cellSize = new NSizeL(new NLength(15, NGraphicsUnit.Point), new NLength(30, NGraphicsUnit.Point)); break; case 1: // normal segmentWidth = new NLength(3, NGraphicsUnit.Point); segmentGap = new NLength(1, NGraphicsUnit.Point); cellSize = new NSizeL(new NLength(20, NGraphicsUnit.Point), new NLength(40, NGraphicsUnit.Point)); break; case 2: // large segmentWidth = new NLength(4, NGraphicsUnit.Point); segmentGap = new NLength(2, NGraphicsUnit.Point); cellSize = new NSizeL(new NLength(25, NGraphicsUnit.Point), new NLength(50, NGraphicsUnit.Point)); break; } m_NumericDisplay1.CellSize = cellSize; m_NumericDisplay2.CellSize = cellSize; m_NumericDisplay3.CellSize = cellSize; m_NumericDisplay1.DecimalCellSize = cellSize; m_NumericDisplay2.DecimalCellSize = cellSize; m_NumericDisplay3.DecimalCellSize = cellSize; m_NumericDisplay1.SegmentGap = segmentGap; m_NumericDisplay2.SegmentGap = segmentGap; m_NumericDisplay3.SegmentGap = segmentGap; m_NumericDisplay1.SegmentWidth = segmentWidth; m_NumericDisplay2.SegmentWidth = segmentWidth; m_NumericDisplay3.SegmentWidth = segmentWidth; nChartControl1.Refresh(); }
private void BarsHaveBorders_CheckedChanged(object sender, System.EventArgs e) { NLength length; if (BarsHaveBorders.Checked) { length = new NLength(1, NGraphicsUnit.Pixel); } else { length = new NLength(0, NGraphicsUnit.Pixel); } m_Bar1.BorderStyle.Width = length; m_Bar2.BorderStyle.Width = length; m_Bar3.BorderStyle.Width = length; m_Bar4.BorderStyle.Width = length; nChartControl1.Refresh(); }
private NPanel ConfigureLabel(string text, float orientation, NLength fontSize, ContentAlignment contentAlignment, PanelDockMode dockMode) { NLabel label = new NLabel(text); label.TextStyle.BackplaneStyle.Visible = false; label.TextStyle.Orientation = orientation; label.TextStyle.FontStyle.EmSize = fontSize; label.ContentAlignment = contentAlignment; label.DockMode = PanelDockMode.Fill; label.BoundsMode = BoundsMode.Fit; label.TextStyle.StringFormatStyle.VertAlign = VertAlign.Center; NWatermark labelHostPanel = new NWatermark(); labelHostPanel.DockMode = dockMode; labelHostPanel.UseAutomaticSize = false; labelHostPanel.Size = new NSizeL(new NLength(10, NRelativeUnit.ParentPercentage), new NLength(10, NRelativeUnit.ParentPercentage)); labelHostPanel.ChildPanels.Add(label); return(labelHostPanel); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { EnableInitialPositioningCheckBox.Checked = true; RemoveOverlappedLabelsCheckBox.Checked = false; EnableLabelAdjustmentCheckBox.Checked = true; EnableDataPointSafeguardCheckBox.Checked = true; WebExamplesUtilities.FillComboWithValues(SafeguardSizeDropDownList, 0, 20, 1); SafeguardSizeDropDownList.SelectedIndex = 12; HiddenField1.Value = Random.Next().ToString(); } nChartControl1.Settings.JitterMode = JitterMode.Enabled; nChartControl1.BackgroundStyle.FrameStyle.Visible = false; nChartControl1.Panels.Clear(); // set a chart title NLabel title = nChartControl1.Labels.AddHeader("Polar Chart"); title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 14, FontStyle.Italic); title.ContentAlignment = ContentAlignment.BottomRight; title.Location = new NPointL(new NLength(2, NRelativeUnit.ParentPercentage), new NLength(2, NRelativeUnit.ParentPercentage)); // configure the chart NPolarChart chart = new NPolarChart(); chart.Location = new NPointL(new NLength(5, NRelativeUnit.ParentPercentage), new NLength(5, NRelativeUnit.ParentPercentage)); chart.Size = new NSizeL(new NLength(90, NRelativeUnit.ParentPercentage), new NLength(90, NRelativeUnit.ParentPercentage)); nChartControl1.Charts.Add(chart); // setup polar value axis NLinearScaleConfigurator linearScale = (NLinearScaleConfigurator)chart.Axis(StandardAxis.Polar).ScaleConfigurator; linearScale.RoundToTickMax = true; linearScale.RoundToTickMin = true; linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; linearScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); // setup polar angle axis NAngularScaleConfigurator angularScale = (NAngularScaleConfigurator)chart.Axis(StandardAxis.PolarAngle).ScaleConfigurator; angularScale.MajorGridStyle.SetShowAtWall(ChartWallType.Polar, true); // polar point series NPolarPointSeries series1 = (NPolarPointSeries)chart.Series.Add(SeriesType.PolarPoint); series1.PointShape = PointShape.Ellipse; series1.Size = new NLength(2.0f, NRelativeUnit.ParentPercentage); series1.InflateMargins = true; series1.FillStyle = new NColorFillStyle(DarkOrange); series1.DataLabelStyle.Visible = true; series1.DataLabelStyle.VertAlign = VertAlign.Center; series1.DataLabelStyle.ArrowLength = new NLength(12); series1.DataLabelStyle.ArrowStrokeStyle.Color = DarkOrange; series1.DataLabelStyle.TextStyle.BackplaneStyle.StandardFrameStyle.InnerBorderColor = DarkOrange; series1.DataLabelStyle.TextStyle.FontStyle.EmSize = new NLength(8); chart.LabelLayout.EnableInitialPositioning = EnableInitialPositioningCheckBox.Checked; chart.LabelLayout.RemoveOverlappedLabels = RemoveOverlappedLabelsCheckBox.Checked; chart.LabelLayout.EnableLabelAdjustment = EnableLabelAdjustmentCheckBox.Checked; series1.LabelLayout.EnableDataPointSafeguard = EnableDataPointSafeguardCheckBox.Checked; float safeguardSize = (float)SafeguardSizeDropDownList.SelectedIndex; NLength sz = new NLength(safeguardSize, NGraphicsUnit.Point); series1.LabelLayout.DataPointSafeguardSize = new NSizeL(sz, sz); series1.LabelLayout.UseLabelLocations = true; series1.LabelLayout.OutOfBoundsLocationMode = OutOfBoundsLocationMode.PushWithinBounds; series1.LabelLayout.InvertLocationsIfIgnored = true; // fill with random data GenerateData(series1); }