How to enable smooth zooming in Bokeh? - bokeh

I have just starting looking into making my python graphs interactive. Bokeh seems to have a lot of functionality and I am currently trying it out. One thing that I find aesthetically pleasing with the mpld3 library is the smooth zooming after selecting a region with the zoom tool (like in this example). The default behavior in Bokeh seems to be to jump to the zoomed region without without any animation (example, 'wheel zoom' is smooth, but 'box zoom' is not).
Is the smooth zooming feature available in Bokeh and just disabled by default, or is this not implemented?

This is not implemented as of Bokeh 0.8.2, we do plan to add support for animation, key frames, etc. and smooth box zoom would probably best be implemented on top of that.

Related

How it's made: svg graphs controlled by scrollbar

NYT has just produced this nice chart animation, any idea what tech is behind it?
http://www.nytimes.com/interactive/2014/03/31/science/motorcycle-helmet-laws.html?_r=0
It looks like pretty classical D3 stuff (using SVG under the hood). Not sure how the scroll bar business works, but I see that it doesn't work in IE11, so it probably is library-driven rather than native SVG/JavaScript that generally works well across browsers. The underlying technology of the curve-interpolation can either be done using SMIL (the natural way) or through JavaScript, but interpolating the values of control points of Bezier curves (either quadratic or cubic.) See
http://cs.sru.edu/~ddailey/svg/2011/reshaping.html for examples or curve interpolation. You'll note that Firefox still doesn't handle the second animation on this page, but I suppose I never got around to filing a bug. It should work everywhere else though (except for IE since they don't do SVG/SMIL).

Drawing graphs with purely HTML5

Can any one point me to any resources for making graphs in HTML5? Most of resources I have seen through Google use animated graphs, I just want a simple static graph in HTML5. One more thing, I am really very weak in graphs, so a simple, easy to understand solution would be very helpful. I will be using this XML file to display data in graphical format.
US Canada Mortality
Thanks in advance :-)
Check out the new canvas tag. It allows you to draw shapes including rectangles and circles using javascript. Canvas Tutorials
If you're looking for just a standard bar chart, though, you can use the div tag with a specified width, height, and background color. This method avoids the use of javascript.

css3 shapes compatibility

I'm trying to make a wheel, which will be sliced into different coloured sections (kinda like a pie chart) but they may have extra elements on top of them, e.g., a stitched border across the borders at the side and an icon at the edge of each, etc.
So my question is do I just use css3 (examples: http://www.css3shapes.com/)
and then use something like http://css3pie.com/ for Internet explorer 6-9?
Or am I just better off doing it in Photoshop and slapping it on a div as a background image? And use absolute positioning for extra elements?
Which is the best practice?
I would (and do) use PHP's GD extension to create a pie chart based on input data, save the image generated by that, and optionally generate an imagemap so parts of the chart can be highlighted, have tooltips, etc.
I really wouldn't use CSS for drawing shapes. It's hacky at best, and can get really messy. Quite a few of the examples in the cssshapes site you linked to don't even work in Firefox 3.6 - which is still quite heavily used - let alone other older browsers, and in IE you'd really struggle; css3pie won't give you the kind of fine-grained control you'd need for a pie chart.
If you want to draw stuff on the browser using on the client side, there are a number of ways to do so without resorting to hacks like CSS shapes.
Both SVG and Canvas are relatively new technologies for placing and manipulating graphics on the browser. SVG draws vector graphics and Canvas is for pixel-based graphics.
Both of them are supported on a wide variety of browsers. The obvious exception being IE8 and earlier. However, IE does support an alternative graphics format called VML, and there are javascript tools for IE which allow it to convert both SVG and Canvas into VML, so you can use either of them and they will work in IE using these tools, which makes both SVG and Canvas effectively cross-browser compatible.
But if you're drawing pie charts, or similar sorts of things, my personal recommendation would be to use the Raphael library. This is a javascript library which works in all browsers, and can be used to draw and animate pretty much anything, including graphs and charts (it even has a separate graphing add-on library. See the demos on those two sites to see what it's capable of; I think you'll be impressed. (I certainly was)
Hope that helps.

Server side Charting Library that is design focused

I have been looking for a good server side graphing / charting library that has a lot of design options. Most seem to be very difficult to customize the specific way we are looking to.
I don't mind if it is python, php, java, etc... I just need it to generate server side and output an image to be embedded on a pdf.
Specifically I need the following.
Gradients in bars fill color
Ability to have rounded edges on bars of chart
From a design perspective those are the important ones that I can not find in a specific library.
Ended up using MatPlotLib and used the example below. Essentially you can use an image and set the repeating area of the image. Instead of the gift boxes, I used a rounded corners horizontal gradient image.
http://matplotlib.sourceforge.net/examples/pylab_examples/demo_ribbon_box.html

CSS: On-mouse-over functionality from plot covered by a 'sheen' layer

I have a javascript plot on my page with "data point highlighter" functionality: when the mouse hovers over the point, you can see the coordinates popup. I also want to place a semi-transparent "sheen" image layer over the plot to make it look glossy. I can achieve this with the z-index, but the on-mouse-over functionality of the js plot stops working. Is there a way to have the sheen layer on top and still have the on-mouse-over of the layer below (the plot layer)? Many thanks...
I can't think of a way to do that easily, apart from splitting apart the plot image and the area that reacts to the mouseover, and placing the latter above the sheen - which may be bothersome to do.
If it's semi-transparent, though, would it be an option to do the whole thing the other way round? Placing the "sheen" below the plot, and making the plot semi-transparent?
This is not possible. Shame.
Actually, I believe it is possible, but it's a bit of a messy workaround, and, in essence, involves capturing mouse/cursor position x/y location and mapping that to the plot layer -- not the easiest or optimal task, let alone completely inefficient. I realize this is an older question, but thought I'd point this out for future users.
Update: Firefox has a CSS property geared toward this in the 3.6: http://demos.hacks.mozilla.org/openweb/pointer-events/

Resources