function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdcFanBoysfdcFanBoy 

Bar Chart Horizontal?

Hi All,

 

I have created a vertical bar chart in visualforce page without any issues.  Now I would like to do the same with 'horizontal' orientation.

 

What changes do I need to make apart from changing the Orientation,xField,yField to make a vertical chart to horizontal one?

 

Below are the 2 codes and outputs.

VERTICAL

<apex:chart height="250" width="350" data="{!GenerateChart}"> 
            <apex:axis type="Numeric" position="left" fields="data" title="MT WON" />    
            <apex:axis type="Category" position="bottom" fields="name" title="Month"/>            
            <apex:barSeries orientation="vertical" axis="left" xField="name" yField="data" /> 
        </apex:chart>
        

HORIZONTAL
        <apex:chart height="250" width="350" data="{!GenerateChart}"> 
            <apex:axis type="Numeric" position="left" fields="data" title="MT WON" />    
            <apex:axis type="Category" position="bottom" fields="name" title="Month"/>            
            <apex:barSeries orientation="horizontal" axis="left" xField="data" yField="name" /> 
        </apex:chart>

 

 The horizontal one is weird! 

 

http://i44.tinypic.com/2rqj1o2.jpg

 

Let me know.  Thanks

Sonam_SFDCSonam_SFDC

Manish,

 

I suppose the axis will be reverse in the horizontal bar graph so you should alter the code accordingly.