DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

A Simple Way to Build an ExtJS 3.4 Scatter Chart

Gary Sieling user avatar by
Gary Sieling
·
Nov. 12, 12 · Interview
Like (0)
Save
Tweet
Share
6.11K Views

Join the DZone community and get the full member experience.

Join For Free

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,
        }
      }]
    }
  });
});


Chart Build (game engine)

Published at DZone with permission of Gary Sieling, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Secrets Management
  • Apache Kafka vs. Memphis.dev
  • How to Quickly Build an Audio Editor With UI
  • Top 5 Node.js REST API Frameworks

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: