Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Range property editor is useless when the range value are in DateTime

Hi,
 
My software exposes the range values of both X and Y axis. If i configure the X axis like this:
 

xAxis1.MajorDivisions.LabelFormat = new FormatString(FormatStringMode.DateTime, "HH:mm:ss.fff");

DateTimeFormatInfo dateTimeInfo = new DateTimeFormatInfo();

dateTimeInfo.ShortTimePattern = "HH:mm:ss.fff";

xAxis1.EditRangeDateTimeFormatMode = DateTimeFormatMode.CreateShortTimeMode(dateTimeInfo);

xAxis1.Range = new Range(startTime, TimeSpan.FromSeconds(dRangeInterval));

and if i want to edit the values of the X axis like this

XAxisRange

.Source = new PropertyEditorSource(xAxis1,"Range");

the result is meaningless to any end users.

I think that the Range property editor is not aware of the display format that is used by the chart axises. In that case, specially, this is a problem; this makes the default property editor useless.

How can I customized the PropertyEditorSource object so that I can see and edit the values like is is done on that waveformgraph?

Thanks,

Jean

 

0 Kudos
Message 1 of 10
(6,064 Views)
Here's an image of what this looks like.
 
What you see is the date time raw in double.
0 Kudos
Message 2 of 10
(6,048 Views)
Hi Jean,

I just wanted to see if I could get some more information from you regarding what version of Measurement Studio and Visual Studio that you were using along with seeing if you could post a project that replicates the problem with just the necessary amount of code. Thanks!
Jonathan F.
National Instruments
Applications Engineer
0 Kudos
Message 3 of 10
(5,996 Views)
Here's it is.
 
My question is: how do we configure PropertyEditor to convert double to DateTime.
 
Regards,
 
Jean
0 Kudos
Message 4 of 10
(5,983 Views)

Measurement Studio 8.5

Vs 2005

0 Kudos
Message 5 of 10
(5,980 Views)

Jonathan,

is there someone looking into that so far? I didn't received any feedback yet.

Regards,

Jean

0 Kudos
Message 6 of 10
(5,867 Views)
Hi Jean,

I will take a look at this and get back to you. Thanks for posting on the forums.
Manooch H.
National Instruments
0 Kudos
Message 7 of 10
(5,828 Views)
Hello Jean,

I have been looking into this a little bit with Manooch, and think that we have a solution for you (I apologize for how long it has taken).  The implementation of this solution is not as simple as I had initially hoped, but I think that in the long run will give you the most flexibility.  The main idea associated with this solution is to create your own PropertyEditorSource class which implements two other classes - one for converting from the Date-Time string to the double value that the graph uses, and one for implementing a custom user control that will show when the user click the drop down button on the PropertyEditor Control. 

In the first class used by the custom PropertyEditorSource (inherited from TypeConverter), you will override two methods - ConvertFrom and ConvertTo.  In the second class (inherited from UITypeEditor), you will override the EditValue method, in which you will design your code to drop down your own custom control.

I have attached a modified version of the previous code you had attached which implements these two features, and should give you what you are looking for.  However, in this implementation, I have omitted most error checking have not done much testing, so the code should be used more as a template than a complete solution.

Please let me know if you have any trouble with it, or if there is anything about the code that I can clarify for you.  Thanks!

NickB
National Instruments
0 Kudos
Message 8 of 10
(5,730 Views)
Oops...

I just realized I forgot to remove the pre and post build events that make the code compatible with my 64-bit machine.  If you don't have a 64-bit machine, you will need to delete the pre and post build events to run the code.  Sorry about that...

NickB
National Instruments
0 Kudos
Message 9 of 10
(5,726 Views)

 

 Hello Nick,

 

Thanks for your support. I understand what you have done. I simply wonder if the  Converter property from the PropertyEditorSource class would have include a set statement, then the whole problem would have been solved by passing it a custom TypeConverter?

 

// Summary:

// Represents a property that is edited in a property editor control.

[Editor("NationalInstruments.UI.Internal.Design.PropertyEditorSourceEditor, NationalInstruments.UI.Design, Version=8.5.20.220, Culture=neutral, PublicKeyToken=4544464cdeaab541", typeof(UITypeEditor))]

public class PropertyEditorSource : IServiceProvider, IDisposable

 

// ... 

 

// Summary:

// Gets the type converter for the property.

[Browsable(false)]

[DesignerSerializationVisibility(0)]

public virtual TypeConverter Converter { get; set; }

 

}

 

So, I don't know if this could be a future improvement in the next version. Also, as a comment, I found that sometimes the Measurement Studio framework is less open than the .NET Framework, For exemple, often only get properties are available and many usefull class are internal to your assemblies. For this exemple, I could have reuse the original RangeEditorUI instead of creating a new one.

 

In any case, your project will help me go forward in my project. At least something can be done. But, in the future, I suggest that you might open up a little bit your framework by offering more set and unhiding more usefull class.

 

Thanks,

 

Jean

0 Kudos
Message 10 of 10
(5,626 Views)