PDA

View Full Version : [CLOSED] Renderer in AxisLabel (MVC)



AaronDev
Dec 08, 2014, 12:04 AM
Is there an equivalent in MVC to the chart sample Label Renderer as shown in the webforms samples?


<ext:NumericAxis
Fields="Data1"
Position="Bottom"
Grid="true"
Title="Number of Hits"
Minimum="0">
<Label>
<Renderer Handler="return Ext.util.Format.number(value, '0,0');" />
</Label>
</ext:NumericAxis>

From what I can see Renderer isn't a property of AxisLabel

Daniil
Dec 08, 2014, 1:04 PM
Hi @AaronDev,

This appears to be working for me.

Example

@(Html.X().Chart()
.Axes(
Html.X().NumericAxis()
.Label(Html.X().AxisLabel()
.Renderer(r => r.Handler = "return Ext.util.Format.number(value, '0,0');")
)
)
)

AaronDev
Dec 08, 2014, 1:14 PM
Thanks.

I wasn't using the Builder. Instead I was implementing it in the same form as the demos and couldn't see any Renderer properties.


.Label(
new AxisLabel {Font = "13px Arial"}
)

Using the builder I get intellisense and it works perfect.

Daniil
Dec 08, 2014, 1:27 PM
This should be also working.

@(Html.X().Chart()
.Axes(
Html.X().NumericAxis()
.Label(new AxisLabel
{
Renderer =
{
Handler = "return Ext.util.Format.number(value, '0,0');"
}
})
)
)

AaronDev
Dec 08, 2014, 1:41 PM
Just tried it and yes it does work. Intellisense doesn't work for me on that property but because it works on other properties on axislabel and I could find any samples with it I had assumed the property wasn't there. I'll not rely on intellisense in the future.

Thanks again.

Daniil
Dec 08, 2014, 2:27 PM
IntelliSense is good, but sometimes it behaves incorrectly. So, yes, please do not rely on that too much.