Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
945
Using FormatLabel to add '$'
posted

Guys,

I've been searching on the website for an answer and I've come across a few answers that I thought would work but didn't. I am using the code below in my axes and I want to be able to append the dollar sign '$' to the front of the numeric Y axes. Can someone please point me in the right direction with code. This is also being done in MVC4/5.

//Code

.Axes(axes =>
{
axes.CategoryX("catX").Label(item => item.Month);
axes.NumericY("numY");
})

I've tried using something like this but it doesn't work for me.

.Axes(axes =>
{
axes.CategoryX("catX").Label(item => item.Month);
axes.NumericY("numY").FormatLabel("function (val) {return '$' + val;}");
})

//end code

Any help would be great.

Parents
No Data
Reply
  • 945
    Verified Answer
    posted

    Not really sure what was going wrong but after adding the following code I was able to get the label to work correctly.

    axes.NumericY("numY").MinimumValue(0).FormatLabel("function (val) {return '$' + val;}");

    Hope this helps someone else in the future. 

Children
No Data