Skip to content
Nicolas Morel edited this page Mar 16, 2014 · 6 revisions

Welcome to the gflot wiki!

Compatibility

GFlot version GWT version JQuery version Flot version
1.0 and under 1.5+ ? 0.5
2.0 1.6+ 1.5.1 0.7
2.1 to 2.3.2 2.0+ 1.5.1 0.7
2.4.0+ 2.0+ 1.7.1 0.7
3.1.0+ 2.2.0+ 1.8.3 0.8
3.1.1+ 2.2.0+ 1.8.3 0.8.1
3.2.1+ 2.2.0+ 1.8.3 0.8.2

Advanced usage

Injection of flot javascript files

GFlot can automatically inject required flot javascript files inside the html page. By default, jquery, flot and all the flot plugins managed by GFlot are injected.

The current javascript files loaded are :

You can find all thoses files here : https://github.com/nmorel/gflot/tree/master/flot

You can retrieve the javascript files from flot website : http://code.google.com/p/flot/downloads/list or directly in the source of this project.

It is possible to customize this injection.

Since version 2.4.0

GWT properties have been added to customize the injection. You can find them all in the file GFlot.gwt.xml.

Disable a plugin

To disable a plugin, you just have to mark it as disabled in your .gwt.xml file. For the pie plugin for example, add the following line : Add the following line to your .gwt.xml file :

<set-property name="gflot.load.flot.pie" value="DISABLED" />
Disable all the injection

Add the following line to your .gwt.xml file :

<set-property name="gflot.load" value="EXTERNAL" />

With this option, you will have to load yourself the javascript files.

Or to disable only JQuery injection, add the line :

<set-property name="gflot.load.jquery" value="EXTERNAL" />

Prior to 2.4.0

Prior to 2.4.0, there are 2 options to customize the injection.

Custom FlotJavaScriptLoader

Create your own implementation of FlotJavaScriptLoader.Impl and tell GFlot to use it by adding the following lines to your .gwt.xml :

  <replace-with class="YourOwnFlotJavaScriptLoader">
    <when-type-is class="ca.nanometrics.gflot.client.resources.FlotJavaScriptLoader.Impl" />
  </replace-with>
Disable injection

To disable the injection, add the following lines to your .gwt.xml :

  <replace-with class="ca.nanometrics.gflot.client.resources.FlotJavaScriptLoader.NoInjectionImpl">
    <when-type-is class="ca.nanometrics.gflot.client.resources.FlotJavaScriptLoader.Impl" />
  </replace-with>

You can then add the javascript files you want to use into the header of your html page. For example :

    <!-- flot library -->
    <!--[if lte IE 8]><script language="javascript" type="text/javascript" src="gflotsample/js/excanvas.min.js"></script><![endif]-->
    <script language="javascript" type="text/javascript" src="gflotsample/js/jquery.min.js"></script>
    <script language="javascript" type="text/javascript" src="gflotsample/js/jquery.flot.min.js"></script>
    <script language="javascript" type="text/javascript" src="gflotsample/js/jquery.flot.selection.min.js"></script>

Flot Image plugin

Since version 2.2.2, gflot partially supports the image plugin.

To use it, add ImageDataPoint instead of DataPoint to the model. The first parameter is the url of the image.

You also have to set the image "show" option to true on the global series options or directly on the series options.

Finally, call the method plot.setLoadDataImages( true ); on your SimplePlot. It will load the images before creating the plot.

The flot plugin has been modified to prevent NullPointerException when the loadDataImages function is called and no image options have been set. If you use the automatic injection, it is transparent. If not, you can download the modified scripts in the download pages. The plugin is still usable without the modification but you have to define the image options on global series options and specific series options.