Skip to main content

JMaki Charting click event

3 replies [Last post]
stuow
Offline
Joined: 2008-01-07

Hey All,

The charting widgets are great, but in order for them to provide the functionality required in my app I need to be able to click through a chart, specifically a bar in a bar chart ... basically I need to build a drill through style of dashboard where clicking one bar on the "top-level" chart will asynchronously load more detailed data in a sub-leveled chart. JMaki charting provides everything I need, except the click-through functionality.

I have been playing with the JMakji events framework and jmaki actions, but I can't seem to get an onclick event to be attached to either the dojo or plotkit bar chart. I have also tried adding markers to a plotkit bar chart, but they do not get rendered. The following line in the plotkit base.js addMarker function is false when being executed on a bar chart as the points array is empty, meaning no markers get added to the chart.

if (targetIndex < _widget.layout.points.length &&
_widget.layout.points.length > 0)

Is there any way that I am missing for adding an onClick event to one of these bar charts? The Marker click event is not an optimal solution, but it would provide the onClick functionality.

One other complete aside is that I have found what I think is a small problem with the yahoo DataTable. The publish argument for the widget was not working as I was not receiving events on a custom topic I had passed to the widget using

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31

Hi,I have fixed the markers to work also with bar and pie charts. The calculation was based on different properties. These changes will be in the next charting release (hopefully within another day or so) or you can download the base file which you can replace the /resources/jmaki/charting/plotkit/resources/base.js with the one here: https://jmaki-charting.dev.java.net/source/browse/*checkout*/jmaki-chart... Let us knwo if this does not work for you. -Greg

stuow
Offline
Joined: 2008-01-07

Hey Greg,

I tried your updated file and it works great! I didn't open a defect on the bar chart stuff, let me know if you still want me to, for tracking purposes. I did open one on the yahoo.dataTable issue I noted above ... I hope that was ok.

I have been going through the base.js for the plotkit charts, as I would really like to be able to put an onClick event on the div for each of the bars in the bar chart, exactly the way you have for the markers. I'm definitely no javascript expert ... and basically have been coming up empty on my attempt. Do you have any insight as to how I might go about accomplishing this? The markers are nice, but being able to click the actual "data", i.e a bar in the bar chart, or even a slice in the pie chart, etc would be a really nice feature.

Thanks alot for the help so far!

Stu

gmurray71
Offline
Joined: 2003-07-31

Hi,I was able to verify the problem with the Plotkit Bar chart and I will be trying to fix it within the next day or so. Could you be so kind as to file an issue on the jMak charting issue tracker? https://jmaki-charting.dev.java.net/servlets/ProjectIssues so we can track this?Thank you! -Greg