Profile Picture

problems with Ndatetimeformatter

Posted By Hans Henrik Friis Pedersen... 9 Years Ago
Author
Message
Nevron Support
Posted 9 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Hans,

You need to turn off unit sensitive formatting:

dateTimeScale.EnableUnitSensitiveFormatting = false;

More information on unit sensitive formatting can be found here:
http://helpdotnetvision.nevron.com/UsersGuide_Axes_Scale_Scale_Labels.html

Hope this helps - let us know if have any questions.


Best Regards,
Nevron Support Team



Hans Henrik Friis Pedersen...
Problem Posted 9 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 28, Visits: 136
Hi,

I'm using the code below but I can't get the correct format of the datetime at the x-axis. It is consistently shown as "yyyy-mm-dd" but I would like to have the time component included - like "yyyy-mm-dd hh:nn:ss"

The code below does not show the time component altoug the ".datehour" should do that??


            NChart m_Chart;
            NPointSeries m_Point;

            // set a chart title
   NLabel title = nChartControl1.Labels.AddHeader("2D Point Chart");
   title.TextStyle.FontStyle = new NFontStyle("Times New Roman", 18, FontStyle.Italic);

            // setup chart
            m_Chart = nChartControl1.Charts[0];
            m_Chart.Axis(StandardAxis.Depth).Visible = false;
           
            // add interlace stripe
            NLinearScaleConfigurator linearScale = m_Chart.Axis(StandardAxis.PrimaryY).ScaleConfigurator as NLinearScaleConfigurator;
            linearScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            linearScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot;
            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);

            NDateTimeScaleConfigurator dateTimeScale = new NDateTimeScaleConfigurator();
            dateTimeScale.LabelValueFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.DateHour);
            dateTimeScale.MajorGridStyle.ShowAtWalls = new ChartWallType[] { ChartWallType.Back };
            dateTimeScale.MajorGridStyle.LineStyle.Pattern = LinePattern.Dot; dateTimeScale.LabelGenerationMode = LabelGenerationMode.Stagger2;
            m_Chart.Axis(StandardAxis.PrimaryX).ScaleConfigurator = dateTimeScale;

            m_Point = (NPointSeries)m_Chart.Series.Add(SeriesType.Point);
            m_Point.Name = "Point Series";
            m_Point.InflateMargins = true;
            m_Point.Name = "Point Series";
            m_Point.DataLabelStyle.Visible = false;
            m_Point.FillStyle = new NColorFillStyle(Color.Red);
            m_Point.BorderStyle.Width = new NLength(0);
            m_Point.Size = new NLength(1, NRelativeUnit.ParentPercentage);
            m_Point.PointShape = PointShape.Ellipse;
            m_Point.UseXValues = true;

            m_Point.XValues.AddRange(Data2.Select(x => x.dateAndTime.ToOADate()).ToArray());
            m_Point.Values.AddRange(Data2.Select(x => x.value).ToArray());

https://www.nevron.com/forum/uploads/images/9b3c6b81-71cc-4358-bd53-41b.jpeg




Similar Topics


Reading This Topic