Profile Picture

NDateTimeScaleConfigurator AutoScale: current format

Posted By Ereona 13 Years Ago
Author
Message
Ereona
Posted 13 Years Ago
View Quick Profile
Forum Member

Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 43, Visits: 1
Hello.
I use autoscale for OX axis like this:
List dateTimeUnits = new List();

dateTimeUnits.Add(NDateTimeUnit.Second);
dateTimeUnits.Add(NDateTimeUnit.Minute);
dateTimeUnits.Add(NDateTimeUnit.Hour);
dateTimeUnits.Add(NDateTimeUnit.Day);
dateTimeUnits.Add(NDateTimeUnit.Month);
dateTimeUnits.Add(NDateTimeUnit.Year);

var autoUnits = dateTimeUnits.ToArray();

dateConfigurator.MajorTickMode = MajorTickMode.AutoMaxCount;

dateConfigurator.InflateViewRangeBegin = false;
dateConfigurator.InflateViewRangeEnd = true;

dateConfigurator.EnableUnitSensitiveFormatting = true;
dateConfigurator.AutoDateTimeUnits = autoUnits;
dateConfigurator.LabelValueFormatter = new NDateTimeValueFormatter("dd.MM HH:mm:ss");
The value format depends on graph's scale. How I can determine the current Date-time unit and value format in axes's properties?

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 Ereona,

You cannot get the date time unit selected by the scale, however you can change the value format that corresponds to a unit - for example:

someDateTimeScale.DateTimeUnitFormatterPairs.DayFormatter = new NDateTimeValueFormatter(DateTimeValueFormat.DateHour);

changes the default day formatting to day + hour. The other units have similar properties, SecondFormatter, MinuteFormatter etc.



Best Regards,
Nevron Support Team



Ereona
Posted 13 Years Ago
View Quick Profile
Forum Member

Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 43, Visits: 1
I need to format one additional value (not on the axis) like the values are formatted on axis. If I set the format manually, I can do it:
label.Text = ((NStandardScaleConfigurator)xAxis.ScaleConfigurator).LabelValueFormatter.FormatValue(value);
But with autoformat it's impossible, isn't so?

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 Ereona,

The standard formatters rely that the value is of type double - they do not try to convert for performance reasons and may fail if used in such context. What is the value you pass there? 



Best Regards,
Nevron Support Team



Ereona
Posted 13 Years Ago
View Quick Profile
Forum Member

Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)Forum Member (43 reputation)

Group: Forum Members
Last Active: 11 Years Ago
Posts: 43, Visits: 1
The value is correct double value. Without autoformat I get the correct string - the value is formatted like value on axis. But with autoformat I get the string with default format (which I set for LabelValueFormatter), not with current.



Similar Topics


Reading This Topic