Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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>
@priyaponni

This comment has been minimized.

Copy link

@priyaponni priyaponni commented Apr 4, 2018

@sohalloran, This code doesn't work with firefox as window.event should be injected to the function, for it work in firefox. Any pointers how to make this work in Firefox.

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment