Last active
April 4, 2018 21:07
-
-
Save sohalloran/4694551 to your computer and use it in GitHub Desktop.
Visualforce Charting with drill down when clicking on chart sections/bars
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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
@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.