Profile Picture

Set of a DateTime-Format

Posted By Alexander Sorich 13 Years Ago
Author
Message
Alexander Sorich
Posted 13 Years Ago
View Quick Profile
Forum Newbie

Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)

Group: Forum Members
Last Active: 13 Years Ago
Posts: 9, Visits: 1
Hello,

I'm looking for an example for using a given DateTime on the PrimaryX Axis.
How can i set a DateTime-Format for the X-Axis for example "YYYY. MM. DD. HH. MM " /"2011. 08. 01. 10.05" ?

Best Regards,

Alexander

Nevron Support
Posted 13 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: Last Week
Posts: 3,054, Visits: 4,009

Hi Alexander,

You'll have to change the date / time value axis formatter:

 

using Nevron.Dom;
using Nevron.Chart.WinForm;
using Nevron.Chart;
using Nevron.GraphicsCore;

NChart chart = nChartControl1.Charts[0];
NLineSeries line = new NLineSeries();
line.Values.Add(10);
line.Values.Add(20);
line.Values.Add(30);

DateTime now = DateTime.Now;
line.XValues.Add(now.ToOADate());
now +=
new TimeSpan(200, 0, 0, 0);
line.XValues.Add(now.ToOADate());
now +=
new TimeSpan(200, 0, 0, 0);
line.XValues.Add(now.ToOADate());

line.UseXValues = true;
chart.Series.Add(line);

NDateTimeScaleConfigurator dtScale = new NDateTimeScaleConfigurator();
dtScale.EnableUnitSensitiveFormatting =
false;
dtScale.LabelValueFormatter =
new NDateTimeValueFormatter("yyyy MM dd HH MM");
chart.Axis(
StandardAxis.PrimaryX).ScaleConfigurator = dtScale;

nChartControl1.Refresh();

Hope this helps - let us know if you meet any problems...



Best Regards,
Nevron Support Team



Daniel Joubert
Posted 12 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 10, Visits: 1

When I try this example the dates start with 1899.

What am I doing wrong?



Attachments
datetime.jpg (76 views, 35.00 KB)
Nevron Support
Posted 12 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: Last Week
Posts: 3,054, Visits: 4,009

Hi Daniel,

Most likely you did not specify that the series uses X values:

someSeries.UseXValues = true;

In that case the control generates automatic x values starting from 0 which maps to date time representation of 1899.

Hope this helps - let us know if you meet any problems.



Best Regards,
Nevron Support Team



Daniel Joubert
Posted 12 Years Ago
View Quick Profile
Junior Member

Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)Junior Member (10 reputation)

Group: Forum Members
Last Active: 12 Years Ago
Posts: 10, Visits: 1

Thanks, that solved my problem!





Similar Topics


Reading This Topic