Some issues obtaining the latest version of Flot

94 views
Skip to first unread message

Joel DeWitt

unread,
Sep 2, 2019, 10:53:13 AM9/2/19
to Flot graphs
I would like to detail my experience in attempting to obtain the latest version of Flot. This is related to the thread Some concerns about recent changes.

This discussion is concurrent with my attempt to migrate from v0.8.3. My first attempt was to simply download the ZIP from GitHub. (This is apparently v3.0.0.) My legends are not rendering correctly under this version (please see cited discussion), so my thinking is that I'm using a slightly broken version. I was advised instead to use npm. I'm not a developer, and I don't know what that is, but I wanted to try unpkg first in the <head> section of my document:

    <script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.canvaswrapper.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.colorhelpers.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.flot.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.flot.saturated.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.flot.browser.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.flot.drawSeries.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.flot.uiConstants.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.flot.hover.js"></script>
   
<script src="https://unpkg.com/browse/fl...@3.2.9/source/jquery.flot.legend.js"></script>

The above attempts to pull v3.2.9 directly using the unpkg CDN. This caused my entire Flot graph to break for reasons unknown to me.

My next attempt is to use npm, which requires an installation of Node.js. After following the instructions outlined at A Beginner's Guide to npm, I am ready to install the Flot package either globally or locally. My feeling is that I should do this locally as this does not require root privileges. My question is, what happens when I enter npm install flot? Where does it "live"? Is this specified in package.json?

Please keep in mind that I'm just trying to get a current/modern installation of Flot in a local directory that I can include via <script>. Any advice you all can provide will be appreciated!

Jonathan Meyer

unread,
Sep 3, 2019, 11:35:26 AM9/3/19
to Flot graphs
When you execute 'npm install flot' what you should find is in the folder where you executed that command is a node_modules folder under which should be a folder called 'flot'. Here is where all of the packaged distributed files will be unpacked to. Any examples you created would need to reference the files here. You can either reference the full set of functionality using the minified single 'jquery.flot.js' file in the 'dist' folder, or reference individual files located under the 'source' folder.

View the source of this example to see how it includes the scripts (it uses the unminified scripts from the 'source' folder).

Regarding the legends, they almost certainly have changed quite a bit from the 0.8.3 release and I'd be happy to help with trying to move you to the newer versions as well as identifying the functional gaps so we can create Issues to track them.
Reply all
Reply to author
Forward
0 new messages