PDA

View Full Version : How to change Stacked Column chart colors



mattsh
10 May 2011, 6:53 AM
Hi!

I desperately need to change the column color for my charts. I think I have tried almost everything, but it doesn't work. I use the Logos 4 application at my Joomla cms site.

Ext js file - chart.html.php

<?php else : ?>
xField: '<?php echo $key->field ?>',
xAxis: new Ext.chart.<?php echo $key->axis ?>Axis({
title: '<?php echo $key->title ?>'
<?php if ( isset($key->render) ) { ?>
,labelRenderer : <?php echo $key->render ?>
<?php } ?>
}),
yAxis: new Ext.chart.<?php echo $d->axis ?>Axis({
title: '<?php echo $query->getConfig('CHART_DATA_TITLE',$d->title) ?>'
}),
series: [
<?php
$comma = '';
foreach ( $series as $s ) {
echo "$comma { type: '$s->type', displayName: '$s->title', yField: '$s->field', labelRenderer : $s->render }";
$comma = ",\n";
}?>
]
<?php endif; ?>

Logos 4 also uses "querys" like this

SELECT
<output name="quarter" data="string" chart="k" />,
<output name="started" data="int" chart="d" />,
<output name="closed" data="int" chart="d" />,
<output name="open" data="int" chart="d" />,
<output name="id" hidden="y" />
FROM db_table

Any code support would be very appreciated. Thanks!

Regards
Matt

ero
11 May 2011, 3:45 AM
Code:
series: [{
xField: 'A',
displayName: 'A'
,style: {color: 0x34ff0a}
},{
xField: 'B',
displayName: 'B'
,style: {color: 0xd4ff51}
}]

ero
11 May 2011, 3:46 AM
I'm not sure if this is what you are looking for, but for my 3.31 stacked charts, I used the following.

Code:
series: [{
xField: 'A',
displayName: 'A'
,style: {color: 0x34ff0a}
},{
xField: 'B',
displayName: 'B'
,style: {color: 0xd4ff51}
}]

mattsh
11 May 2011, 4:22 AM
Thanks!

You made me not give up! I haven't tested it a lot but I think it works.

If someone is interested? I changed the code like this:

series: [
<?php
$comma = '';
foreach ( $series as $s ) {
echo "$comma { type: '$s->type', displayName: '$s->title', yField: '$s->field', labelRenderer : $s->render }";
$comma = ",\n";
}?>
]
to (changed your example slightly):

series: [{
yField: 'A',
displayName: 'A'
,style: {color: 0x34ff0a}
},{
yField: 'B',
displayName: 'B'
,style: {color: 0xd4ff51}
}],


Thanks!

Matt

ero
11 May 2011, 4:37 AM
Sorry for the formatting of the code. That was my first post to the forum and I was trying to look up how to do it properly - I didn't realize it actually posted.