Profile Picture

problems with Ndatetimeformatter

Posted By Hans Henrik Friis Pedersen... 9 Years Ago
Author
Message
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