O'Reilly logo

Learning jqPlot by Scott Gottreu

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying an existing plugin

We arrive in the office the next morning just before nine o'clock. We begin thinking about Jeff's request to add a cursor tooltip to his donut chart. The cursor plugin does not create a tooltip for donut charts. So, if we want a tooltip, we will have to create one. We decide to look at modifying the donut renderer plugin to accomplish this.

We open the file, jqplot.donutRenderer.js, found in our js folder and save it as a new file called jqplot.donutRendererV2.js. We begin working our way through it. The entire plugin is a method attached to the jqPlot object and by default attached to jQuery. We see that DonutRenderer inherits its structure from the LineRenderer plugin:

 $.jqplot.DonutRenderer = function(){ $.jqplot.LineRenderer.call(this); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required