I'm not really sure where I'm going wrong here but I can't get a graph to appear when creating a graph from Flot.

I don't have a debugger working right now to figure out where it's happening but somewhere the data for my graph is disappearing. The query that's generated by Views is correct and returns data into the Views system but by the time I get to flot_views_plugin_style.inc, all the data is gone.

I'm afraid I'm just missing something really obvious somehow so a few pointers on how to debug this would be appreciated. I've copied the Flot views from ManagingNews as close as I can but still no dice. Also, as I'm sure this is a common problem, I am using Global: Data Point for my field.

CommentFileSizeAuthor
#6 flot-time-gap.png18.37 KBR.J. Steinert

Comments

kyle_mathews’s picture

Title: Flot not showing up for View » Document that you must include a date filter for your flot view to work.
Component: Miscellaneous » Documentation
Category: support » feature

I persevered and conquered.

So as it turned out, what was wrong with my view was it didn't have a filter on some sort of date. These lines in flot_handler_field_datapoint.inc kill your view unless you have a date/time filter enabled (but not a filter from the date module as it turns out).

      foreach ($filters as $filter => $handler) {
        if (strpos(get_class($handler), '_date') !== FALSE) {

In light of that, I've changed this issue to a documentation feature request.

deggertsen’s picture

It would be nice if views provided a warning when using the flot style to let you know that this is needed when it tries to generate a preview or something.

kyle_mathews’s picture

Status: Active » Needs review
R.J. Steinert’s picture

I've been banging my head on the wall with trying to config a view with a unit of time on the y axis. While I have been able to get a few graphs out, getting a graph that looks like I would expect has driven me to the point that I know I have to read the code to grok the flot views plugin. Could anyone provide me with a feature module with views and content type definitions that achieve a good config? The managing news install profile has too much going on for me to really get an idea of what's going on. Even a screenshot of Views config and outcomes would be GREAT.

Anyone's help would be greatly appreciated! :)

R.J. Steinert’s picture

Looking through the code, if I'm reading this correctly, when you put a unit of time on the y axis, the flot module will default to counting the results as opposed to using the raw value. This doesn't look like a bug, it's just unfinished (looks like all Dev Seed's implementation of the Flot module just use count anyways).

Thinking about this problem further brings up some tough questions in regards to granularity.

For starters, try to display all nodes with date filter set to "before now" with granularity set to "day", you'll get a result set with a datapoint for every day since 1969 (the beginning of time for some computers ;) ). This is because the Flot module's style plugin is generating a data point for each unit of time to feed to the Flot JS library.

As far as being able to use raw values granularity poses a challenge again. What do you when the two points of raw data fall between the levels of granularity? Output the average? Favor the closer one? I may have to consult my college stat books on this one for common practices. I'm not so interested in turning the Flot module into a statistics package (that would be better suited by another module that utilizes the existing Flot module), just looking for a good way to gracefully handle most cases of displaying 'raw' data. The issue with generating a data point for each unit of time (if Flot JS really requires it) might make Flot JS unsuitable for use on websites that want to display data over time.

I would love if someone from Dev Seed chimed in as it looks like they ran into this and decided to let it be.

R.J. Steinert’s picture

StatusFileSize
new18.37 KB

It looks like Flot JS allows for big gaps in the data. I took the example here, http://people.iola.dk/olau/flot/examples/time.html, and cut out a large portion of data in the middle and got the attached screenshot. That means if we remove the part of the Flot module that generates a datapoint for every unit of time then we can have very fine granularity over long periods of time without generating a bunch of datapoints that are just 'padding' between other datapoints.

R.J. Steinert’s picture

O snap. Discrepancies between GitHub and Drupal's CVS dev http://github.com/KyleAMathews/Drupal-Flot/commit/8eb9e41bfd515bf5f85664...

And I found an issue more relevant to what I'm talking about :) http://drupal.org/node/845670

beakerboy’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)