BLOG POST VOM 28. August 2009

Ext JS Charts Problem: Y-Scale is always 0 to 1

During the last few hours I was playing around with Ext JS charts. I got stuck for a while because the height of my y-axis was limited to one; no matter what I tried and how high the numbers of my records were – the y-scale was fixed to 1.

Ext JS chart

After some time I figured out that there’s a problem with PHP’s json_encode(). Due to that problem I formatted the data for my chart as strings (with quotation marks) instead of integers (without quotation marks).

There are two solutions to fix this problem: First, you can make sure that the PHP variables that contain integers are really numeric types (and not strings). The second, much easier solution, is to properly define the Ext JS fields for the charts:

fields = [
  {name: 'interval'},
  {name: 'field1', type: 'int'},
  {name: 'field2', type: 'int'}
];

And that’s it!

Tags » «

Autor:
Datum: Freitag, 28. August 2009, um 15:58 Uhr
Themen: (Web) Development, Ext JS

Trackback: Trackback-URL | Feed zum Beitrag: RSS 2.0

Neuer Kommentar