Two questions - Customizing zoom, and customizing CircleElementPointMarker

Dec 4, 2012 at 12:24 PM

I'm new to D3 and have run into two challenges I need guidance on; I hope someone can help:


1) I need to override the zoom behavior, such that each time the user zooms (e.g., mousewheel, and right click 'fit to view') I can update the chart (i.e., add some markers) and do normal zoom behavior.  How do I customize/override default zoom?

2) I am adding some markers to my chart, but seem to be limited to circle (e.g., CircleElementPointMarker) or rectangle plain Jane markers.  How can I do something a little more custom (e.g., circle with a letter within circle, or icon)?


Thanks for the help.

Dec 10, 2012 at 6:54 PM

You can take control of the MouseWheel events in the MouseNavigation class. All the mouse events are handled there.


You certainly can do pretty much any marker. Simply add a class to the PointMarkers folder in the source code and derive the class from ShapePointMarker. Now, in the render method, you can choose whatever shape you want to draw. If what you are trying is too complex to render using the drawing context, you can also derive a class from ShapeElementPointMarker and add your own objects to the chart. However, ShapeElementPointMarker seems to consume more CPU resources, so be careful with what you are trying to implement. :)