+ Start a Discussion
S.AjS.Aj 

Axis Values

In visual force charting how can we ensure that zero axis is always displayed and  the step values are rounded off to hundred. For certain reasons the value zero does not appear on the chart and thus making the graph hard to read, As you can see in the image the axis the values are not equally distributed on the positive and negative axis.

 

 

 

 

Thanks in advance

Regards

S.Aj

MagulanDuraipandianMagulanDuraipandian

Axis always starts with 0.

 

Check this

 

https://sites.google.com/site/infallibletechie/pie-chart-and-bar-chart-using-apex-in-visualforce-page

 

Regards,

Magulan D

Salesforce.com certified Force.com Developer.

SFDC Blog

SFDC Site

If this post is your solution, kindly mark this as the solution and give Kudos.

cwall_sfdccwall_sfdc

to config axis steps, play around with apex:axis.minimum and apex:axis steps.

 

Also, apex:chartLabel.renderer takes a reference to a Javascript function.  The function is called for each axis label.

 

<script>
    function axisLabelRenderer(val) {
        return Math.round(...);
    }
</script>

<apex:chart....>
    <apex:axis...>
        <apex:chartLabel rerender="axisLabelRenderer".../>
    </apex:axis>
    ...
</apex:chart>

 

BobNextBobNext

Magu, Thanks for the reply. What if I need to start with a negative value? As shown in the graph, I face the issue when the minimum value is negative.

 

Thanks,

Bob.

BobNextBobNext

cwall_sfdc, Thanks for the reply. I tried with apex:axis.minimum, apex:axis.steps, and apex:axis.maximum. However, I am not able to achieve what I need. My minimum and maximum are dynamic and read from the back end. For example, in one case, it could be (-11,130, 23,445) and in another, it is (-2,034, 123,230). And in some cases, the range is positive, say (11,349, 231,342). These values are read from the back end and passed from the controller. I want to show the zero axis in all the cases.

 

Thanks,

Bob.