-
28 May 2012 6:20 AM #1
Set maximum bar width in ExtJS 4 column chart?
Set maximum bar width in ExtJS 4 column chart?
Hi All,
I have a 250px wide column chart, it looks great when there are 10+ items in the series, but when there's only 2-3, the bars are drawn really wide, which looks somewhat odd.
_____
| |
| |
-----|-----
I can set the width in the series config:
{
style: { width: 25 }
}
This works, but the thinner bars are still left-aligned with their previous position, so they don't match up with the axis tick and label.
Like so:
_
| |
| |
-----|-----
I don't want to change the axis spacing, I want to end up with widely-spaced, 25px bars (that are correctly centered on the axis tick):
_
| |
| |
-----|-----
Any ideas?
-
30 May 2012 1:29 PM #2
What version of ExtJS are you using? I recall reporting this issue and it was corrected.
Regards,
Scott.
-
30 May 2012 9:26 PM #3
-
4 Jun 2012 1:03 PM #4
See if this is working as expected:
f210589.pngCode:Ext.require('Ext.chart.*'); Ext.onReady(function() { var store = Ext.create('Ext.data.JsonStore', { fields: ['name', 'data1'], data: [ { 'name': 'metric one', 'data1': 25}, { 'name': 'metric two', 'data1': 14} ] }); var mychart = Ext.create('Ext.chart.Chart', { renderTo: Ext.getBody(), width: 300, height: 300, store: store, legend: true, axes: [ { type: 'Numeric', position: 'left', fields: 'data1', title: 'Sample Values', minimum:0, }, { type: 'Category', position: 'bottom', fields: 'name', title: 'Sample Metrics', } ], series: [{ type: 'column', axis: 'left', xField: 'name', yField: 'data1', style:{ width:'30', }, label: { field:'data1', renderer: Ext.util.Format.numberRenderer('0'), }, }] }); });
Regards,
Scott.
-
11 Jun 2012 11:07 PM #5
Not aligned properly
Not aligned properly
Thanks Scott for your valuable help.....the width is reduced but the bar is aligned in left most that is not matching with X-Axis lables.. see screenshotdashboard_chart.png
Any help will be appreciated
-
12 Jun 2012 7:36 AM #6
Can you provide a small working example, or modify my example to display your problem?
Scott.
-
12 Jun 2012 8:46 PM #7
-
13 Jun 2012 5:00 AM #8
@ajeetsingh85 . what version exact version of ExtJS4, as this was corrected in a previous version.
Scott.
-
15 Jun 2012 6:24 AM #9
-
15 Jun 2012 6:53 AM #10
But there are numerous releases of 4.1. Have you tried 4.1.1 RC2?I am using Ext JS 4.1
http://www.sencha.com/forum/showthre...-Now-Available
Scott.
You found a bug! We've classified it as
EXTJSIV-8531
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote
