Re: [Lift] Improving lift-flot
Peter Robinett pe...@bubblefoundry.com writes: 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. I had some of the same concerns as you a while back. I ended up writing a wrapper to the JqPlot library instead since it better matched the features we needed. But the inner workings are about the same, so maybe you can use some of the ideas. I'm mainly using category plots with name/value pairs. I have basic structure for a single series: class CategorySeries[T](val categories : List[T], val values : List[Double], val name : Option[String]) And a complete dataset: class CategoryDataset[T](val series : List[CategorySeries[T]], val name: Option[String]) I then defined several different plot types that do the right thing with respect to the dataset: class BarChart[T] (dataset: CategoryDataset[T]) class StackedBarChart[T] (dataset: CategoryDataset[T]) class PieChart[T] (dataset: CategoryDataset[T]) etc I haven't made any partial updates so don't know how well this works here :-) /Jeppe -- 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=en.
Re: [Lift] Improving lift-flot
I'm all for enhancing the flot stuff. Do I see anyone raising their hand to own the changes? On Tue, Nov 24, 2009 at 12:57 AM, Jeppe Nejsum Madsen je...@ingolfs.dkwrote: Peter Robinett pe...@bubblefoundry.com writes: 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. I had some of the same concerns as you a while back. I ended up writing a wrapper to the JqPlot library instead since it better matched the features we needed. But the inner workings are about the same, so maybe you can use some of the ideas. I'm mainly using category plots with name/value pairs. I have basic structure for a single series: class CategorySeries[T](val categories : List[T], val values : List[Double], val name : Option[String]) And a complete dataset: class CategoryDataset[T](val series : List[CategorySeries[T]], val name: Option[String]) I then defined several different plot types that do the right thing with respect to the dataset: class BarChart[T] (dataset: CategoryDataset[T]) class StackedBarChart[T] (dataset: CategoryDataset[T]) class PieChart[T] (dataset: CategoryDataset[T]) etc I haven't made any partial updates so don't know how well this works here :-) /Jeppe -- 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.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Surf the harmonics -- 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=en.
[Lift] Improving lift-flot
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=.