Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save RatanPaul/5fc7f0941097b118d325 to your computer and use it in GitHub Desktop.
Save RatanPaul/5fc7f0941097b118d325 to your computer and use it in GitHub Desktop.
Visualforce Charting with drill down when clicking on chart sections/bars
<apex:chart height="300" width="300" data="{!data}”>
<apex:axis type="Category" position="bottom" fields="ctype">
<apex:chartLabel rotate="270"/>
</apex:axis>
<apex:axis type="Numeric" position="left" fields="cval"/>
<apex:barSeries axis="left" orientation="vertical" xField="ctype" yField="cval">
<apex:chartTips rendererFn="renderer"/>
</apex:barSeries>
</apex:chart>
<script type="text/javascript">
function renderer(klass, item) {
var type = item.storeItem.get('ctype');
var val = item.storeItem.get('cval');
var e = window.event;
var t = e.target || e.srcElement;
t.onclick=function(event){
window.parent.location = "{!$Page.MyDrilldown}?type="+type;
};
this.setTitle(type + " : " + val);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment