1
Vote

Value format string should be user settable

description

Hi,
 A nice job. About the 360dial control. The double value assigned get rounded to int. Can it be shown as double itself and also is there a way to show the unit in the dial along with the value. Like for instance 11.7C (degree centigrade).
 
Regards,
Zap

file attachments

comments

david_black_uk wrote Feb 24, 2009 at 12:03 PM

I think the best solution is to introduce a value format string into the base dashboard control which could be set to say

"{0:000}c"

It will default to the existing format of: "{0:000}". I will do this in the next release

zapping wrote Feb 24, 2009 at 5:18 PM

Thx. and one more pls. The 360dial does not seem to show -ve values like min=-100 and max=100.

david_black_uk wrote Feb 28, 2009 at 8:48 AM

Zapping did you set the dashboard Mininum and Maximum value? See http://www.david-black.info/bashboard/default.aspx and search for minimum. If this still does not work create an issue, as it should

zapping wrote Feb 28, 2009 at 11:39 AM

Hi David,
The needle of the 360dial moves accordingly but the values displayed on the dial remains the same. i.e 0 to 100. I tried it this way
    <my:Dial360 Minimum="-100" Maximum="100" Value="0" />
Since the dial shows 0 to 100 the needs moves to position 50.

david_black_uk wrote Mar 2, 2009 at 3:39 PM

Ok Now I understand the requitrement.

I have added the following fields to all numeric dials and gauges. These effect the way the value is displayed not the way the dial face 0,10,20,30 markers are.
  • TextColor -> Sets the color used to display the Value
  • TextVisibe -> Allows you to turn text off
  • TextFormat -> Allows you to set a format statement for the value ie: {0:00.0}c to give 22.5c
What I will add next is the properties: FaceTextColor, FaceTextVisible and FaceTextFormat which will allow the minimun and maximum values to be modified and for you to specify how this is displayed. Currently the face text color is the TextColor which is a defect.

I will also rename the TextColor, TextVisible and TextFormat fields to ValueTextColor, ValueTextVisible and ValueTextFormat

zapping wrote Mar 12, 2009 at 10:11 PM

Yes. The markers was what meant (Y). For my purpose have added this one to your code.
    /// <summary>
    /// Sets the readings on the dial according to minimum and maximum values
    /// </summary>
    protected void SetDialReading()
    {
        double currentValue = RealMinimum;
        double incValue = (RealMaximum - RealMinimum) * 10 / 100;
        for (int i = 0; i <= 10; i++)
        {
            TextBlock tb = LayoutRoot.FindName("_txt" + i) as TextBlock;
            if (tb != null)
            {
                tb.Text = String.Format("{0:0.0#}", currentValue);
            }

            currentValue += incValue;
        }
    }
Not excatly sure if its the proper way but server the purpose :). With that surely you will have all the more reason to love the look of your 360Dial. Attaching a screen shot. Had to remove the TextWrapping="Wrap" attribute from the marker texts as it tends pull down if the digits are over 2 characters.

One more thing the markers seems to be shifted a bit towards the left or counterclock wise. The zero in the screen shot attached does not seem excatly to the center. Could not get about to fix it. if you can give some tips for that will be much thankful.

Cheers
Zapping

wrote Mar 12, 2009 at 10:11 PM

wrote Feb 14, 2013 at 8:10 PM