Problem
You want to display a scatter chart in ExtJS 3.4.

Solution
Use the Ext.chart.Chart class, and make the lines invisible.
Discussion
This example works by rendering an Ext line chart and setting the “alpha” (visibility) property of the lines to 0 (transparent). If you wanted to add trend lines, you’d need to add visible lines.
ExtJS by default loads the charting .swf file from Yahoo’s CDN, as it uses the charting component from YUI as a base. This was recently updated and no longer works with Ext 3.4- charts do not render at all. Make sure to use the SWF file from the Ext distribution.
This chart resembles one of the ExtJS examples, but their help is fairly poor when it comes to styling. The Yahoo YUI documentation is far more complete.
ExtJS 4 has a scatter chart xtype, which probably works better than this technique.
Ext.onReady(function() { Ext.chart.Chart.CHART_URL = 'ext-3.4.0/resources/charts.swf'; var store = new Ext.data.JsonStore({ fields: ['year', 'comedy', 'action', 'drama', 'thriller'], data: [ {year: 2005, comedy: 34000000, action: 23890000, drama: 18450000, thriller: 20060000}, {year: 2006, comedy: 56703000, action: 38900000, drama: 12650000, thriller: 21000000}, {year: 2007, comedy: 42100000, action: 50410000, drama: 25780000, thriller: 23040000}, {year: 2008, comedy: 38910000, action: 56070000, drama: 24810000, thriller: 26940000} ] }); new Ext.Panel({ width: 390, height: 200, renderTo: 'container', title: 'Scatter Plot - Takings by Genre', items: { xtype: 'linechart', store: store, xField: 'year', xAxis: new Ext.chart.NumericAxis({ minimum: 2004, maximum: 2009, majorUnit: 1 }), yAxis: new Ext.chart.NumericAxis({ labelRenderer: Ext.util.Format.usMoney }), series: [{ yField: 'comedy', displayName: 'Comedy', style: { lineAlpha: 0.0, } },{ yField: 'action', displayName: 'Action', style: { lineAlpha: 0.0, } },{ yField: 'drama', displayName: 'Drama', style: { lineAlpha: 0.0, } },{ yField: 'thriller', displayName: 'Thriller', style: { lineAlpha: 0.0, } }] } }); }); |
Tags: data visualization html5, data visualization tools free, extjs, extjs 3.4, extjs charts, extjs tutorials, free data visualization tools, html5 charts, html5 data visualization, javascript, javascript data visualization, javascript graph library, js chart library, js charting library, js graphing library, js visualization, visualization framework
0 comments ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment