We won't spoil the surprise about the name of the project, yet. :)
Layout and a Renderer that generates and inserts the chart in to the page content (using MochiKit), with a simplistic approach for introducing data-sets.
function drawGraph() {
var layout = new PlotKit.Layout("bar", {});
layout.addDataset("sqrt", [[0, 0], [1, 1], [2, 1.414], [3, 1.73], [4, 2]]);
layout.evaluate();
var canvas = MochiKit.DOM.getElement("graph");
var plotter = new PlotKit.SweetCanvasRenderer(canvas, layout, {});
plotter.render();
}
MochiKit.DOM.addLoadEvent(drawGraph);
The main disadvantage is that SVG and HTML CANVAS support have certain compatibility issues across different browsers and many still need to mature their support for such functionality. This leaves a huge surface of potential interoperability problems which might be a serious show-stopper when deploying PlotKit.
PlotArea). The data-set can be bound to a Store object (similar to the DataSource object of the YUI library), plus it supports all browsers except WebKit powered ones (those pesky Safari users! :) ). Some data analysis methods have been implemented too...
The usage is easy and documentation is very complete (something common with Dojo, probably due to its user base and support from several sponsors):
dojo.require("dojox.charting.widget.Chart2D");
dojo.require("dojox.charting.themes.PlotKit.orange");
dojo.require("dojox.charting.themes.PlotKit.blue");
dojo.require("dojox.charting.themes.PlotKit.green");
dojo.require("dojox.data.HtmlTableStore");
seriesB = [2.6, 1.8, 2, 1, 1.4, 0.7, 2];
dojo.require("dojo.parser"); // scan page for widgets and instantiate them
Note how HtmlTableStore is used and the Parser component. Within the HTML source:
<div dojoType="dojox.data.HtmlTableStore" tableId="tableExample" jsId="tableStore"></div> <table id="tableExample" style="display: none;"> <thead> <tr><th>value</th></tr> </thead> <tbody> <tr><td>6.3</td></tr> <tr><td>1.8</td></tr>If there's something we appreciate from Dojo, it's the flexibility we enjoy from using it. You can certainly keep Dojo in mind for your charting (and several other UI) related needs. Regarding Internet Explorer support, as far as we know, several libraries make use of emulation for setting up HTML CANVAS support through VML.
Charts control with a nice API. The best thing about it: polling data from a DataSource object is supported.
That means dynamic charts, easy interoperability and good performance. Rendering the charts is a piece of cake:
var mychart = new YAHOO.widget.LineChart( "chart", myDataSource,
{
xField: "month",
series: seriesDef,
yAxis: currencyAxis,
dataTipFunction: "getDataTipText"
});
YUI continues to impress us everyday. Since it uses Flash for rendering the charts, any browser with the Flash Player plugin will be able to render them. Also, the Flash charts can contain interactive labels and other useful details. This is clearly a winner in our books (and Dojo is always noteworthy too, but we can't afford using two toolkits since load times will skyrocket).
We've been coming across different annoyances in our quest of deploying YUI into one of our main products (a few more articles talking about its development coming soon), the Ruby on Rails content management system behind our almost-ready customer portal and corporate site. The problem comes mainly from the coexistence of our custom CSS and JavaScript code, and the YUI specific style-sheets and library files.
TabView control is rendering the tabs with an incorrect height:
possibly caused by style conflicts, but we have confirmed this is not the case
(at least our CSS is consistent and not conflicting with YUI).Editor component is unable to adjust its size to a sensible
default (in other words: it seems unable to match approximately the
old size of the barebones textarea element).YUILoader is not liking our layout and failed to expose the
YAHOO.widget objects properly. Thus we couldn't make any real
use of it without resorting to Event driven functions and slow
transitions (as unpleasing as watching a textarea transform into
the Editor UI in “real time” :( ).The problems are really bugging us and we have considered moving to fully custom code, even if that means delaying the development of some other features that might be of higher priority. Hopefully we will solve the issues soon and keep YUI in place, since the functionality is really complete.
Yahoo! released yesterday a new version of the feature-rich, BSD licensed YUI (the Yahoo! User Interface library) implementing several improvements, some new controls and other innovative functionality. The components that quickly turned heads over here, are namely:
Their change-log contains a complete overview of the fixes and the new features. We are integrating this new release for the (Ruby on Rails powered) content management system engine we have developed for our corporate site, and recommend YUI for any serious web developer seeking a library providing solid controls and functionality. Besides, it comes with no strings attached.
Subreption blog by Subreption LLC is Licensed under a
Creative Commons Attribution-Noncommercial-No Derivative Works 3.0
United States License.