我在应用程序中使用 Nevron Charting Control ver.11.1.17.12。我在用DateTimeScaleConfigurator
. 以下是以下问题:
- 如果系列计数增加,系列栏会相互重叠。
- 系列脱离轴心线。
- X Axis Scale 会自动添加上一年
December
和下一年Jan
的比例,这会导致图表在 Surface Chart 的情况下有空白区域。
//绘制条形图系列的代码片段
NBarSeries bar = new NBarSeries();
bar.UniqueId = new Guid(outputVariable.UniqueId);
bar.Name = outputVariable.LegendText;
chart.Series.Add(bar);
bar.HasBottomEdge = false;
bar.MultiBarMode = chart.Series.Count == 1 ? MultiBarMode.Series : MultiBarMode.Clustered;
// bar.InflateMargins = true;
bar.UseZValues = false;
indexOfSeries = chart.Series.IndexOf(bar);
ConfigureChartSeries(bar, indexOfSeries, outputVariable);
SetSeriesAxisInformation(bar, outputVariable.Unit);
bar.UseXValues = true;
foreach (DataRow row in seriesDataTable.Rows)
{
bar.XValues.Add(Convert.ToDateTime(row["TimeStamp"]).ToOADate());
}
添加曲面图系列的代码片段
chart.Enable3D = true;
chart.BoundsMode = BoundsMode.Stretch;
(chart as NCartesianChart).Fit3DAxisContent = true;
chart.Projection.SetPredefinedProjection(PredefinedProjection.OrthogonalTop);
chart.LightModel.EnableLighting = false;
chart.Wall(ChartWallType.Back).Visible = false;
chart.Wall(ChartWallType.Left).Visible = false;
chart.Wall(ChartWallType.Floor).Visible = false;
// setup Y axis
chart.Axis(StandardAxis.PrimaryY).Visible = false;
// setup Z axis
NAxis axisZ = chart.Axis(StandardAxis.Depth);
axisZ.Anchor = new NDockAxisAnchor(AxisDockZone.TopLeft);
NLinearScaleConfigurator scaleZ = new NLinearScaleConfigurator();
scaleZ.InnerMajorTickStyle.Visible = false;
scaleZ.MajorGridStyle.ShowAtWalls = new ChartWallType[0];
scaleZ.RoundToTickMin = false;
scaleZ.RoundToTickMax = false;
axisZ.ScaleConfigurator = scaleZ;
axisZ.Visible = true;
// add a surface series
NGridSurfaceSeries surface = new NGridSurfaceSeries();
surface.UniqueId = new Guid(outputVariable.UniqueId);
surface.Name = outputVariable.LegendText;
chart.Series.Add(surface);
surface.Legend.Mode = SeriesLegendMode.SeriesLogic;
surface.ValueFormatter = new NNumericValueFormatter("0.0");
surface.FillMode = SurfaceFillMode.Zone;
surface.FrameMode = SurfaceFrameMode.Contour;
surface.ShadingMode = ShadingMode.Flat;
surface.DrawFlat = true;
// Already set this property to false and working in other chart.
surface.InflateMargins = false;
surface.FrameColorMode = SurfaceFrameColorMode.Zone;
surface.SmoothPalette = true;
surface.Legend.Format = "<zone_value>";
surface.FillMode = SurfaceFillMode.Zone;
surface.FrameMode = SurfaceFrameMode.Contour;
CreateSurfaceSeries(outputVariable, surface);
chartControl.Refresh();
以及 ScaleConfigurator 配置
chartPrimaryXAxis = chart.Axis(StandardAxis.PrimaryX);
// X Axis Configuration
dateTimeScale = new NDateTimeScaleConfigurator();
dateTimeScale.Title.Text = string.Empty;
dateTimeScale.LabelStyle.Angle = new NScaleLabelAngle(ScaleLabelAngleMode.Scale, 90);
dateTimeScale.LabelStyle.ContentAlignment = ContentAlignment.MiddleLeft;
dateTimeScale.LabelStyle.TextStyle.FontStyle = new NFontStyle("Times New Roman", 6);
dateTimeScale.LabelFitModes = new LabelFitMode[] { LabelFitMode.AutoScale };
chartPrimaryXAxis.ScaleConfigurator = dateTimeScale;
chartPrimaryXAxis.ScrollBar.ResetButton.Visible = true;
chartPrimaryXAxis.ScrollBar.ShowSliders = true;
dateTimeScale.EnableUnitSensitiveFormatting = true;
这是生成的输出:
任何有关此问题的想法将不胜感激。
提前致谢。