I've been working with lift-flot a lot recently and I'd like to share some thoughts and suggest some improvements. It's a very useful interface to a great Javascript plotting library, so consider these as small suggestions from a fan.
First, the fact that FlotSerie's data property is a List[Pair[Double, Double]] means that detail about what you're charting can get lost. If you're plotting more than one line and want to refer to a certain FlotSerie later, you have to rely upon the FlotSerie's label and the order of the List[FlotSerie] used by Flot.render and JsFlotAppendData. This can be addressed either by having a parallel list of your own more expressive data instances, which is what I'm doing, or by only having this more expressive list and having an implicit conversion to a Pair[Double, Double] (I just thought of this and haven't tested it). I can't think of a better way to do this, since everyone's data source will be different and so the generic Pair[Double, Double] is needed – this is just a comment on how the library works. There is a general reliance on List[Pair[Double, Double]] throughout lift-flot and it is an actual annoyance when you are updating an existing graph, for instance via a Comet actor. Speaking of the List [FlotSerie] I mentioned earlier, if you are updating your chart you need to keep this list of series around and update it as you have new data to plot. This is fine except for the fact that JsFlotAppendData requires you to pass it both the updated List[FlotSerie] and a List [Pair[Double, Double]] with one and only one new data point for each FlotSerie. This means that you need to hard-code the list order so that the order of the List[Pair[Double, Double]] matches that of the List[FlotSerie], so that the correct series is updated with the correct new point. I assume you need to give it the new data twice so it knows which FlotSeries have new points and which don't, but this is something the library could do behind the scenes to make the developers' lives easier. More importantly, I don't like the fact that the method replies upon two lists being in the exact same order. So, what would I like to see with lift-flot? Mainly I'd like to see the whole situation with the List[Pair[Double, Double]]'s improved. I don't know if another Flot class, such as a FlotPoint, would help or maybe just making better use of the List[FlotSeries], but I think there definitely is room for improvement. If someone else has been using lift-flot I'd love to hear their suggestions, as perhaps I've been making it more complicated than it actually is. I think a lot of the annoyances I described only crop up when using the JsFlotAppendData method, so I don't won't to propose anything that ends up being a regression for the majority of the library's users. Please let me know if you're doing static charts and anything suggested would make your work more complicated. Since I am using lift-flot a lot (perhaps more than anyone else, seeing how little it's been discussed here recently), I'm more than happy to take the lead and contribute some code if others agree that my suggestions are reasonable (please convince me otherwise!). I guess that the first thing I could do would be to write a tutorial on using the library. Would that be appreciated? Peter Robinett PS I've been working with 1.1-M5 and 1.1-M6, but I don't think there have been any changes to lift-flot since then, let alone any that would invalidate my comments. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=.