ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Bubbles with log scales
Posted by sinan on May-17-2013 17:25
Attachments:
Hi,

in the first picture below you see the problematic bubble chart:
Too many items in the middle of the screen.
Log scaling is not possible because of negative values on both axis.
To get a better distribution of the bubbles, I made a log transformation of the original values by simply taking the logarithm of each value:

for( my $i = 0; $i < @datasets;$i++)
{
    for(my $j = 0; $j < scalar(@{$datasets[$i]});$j++)
    {
        my $v = $datasets[$i]->[$j];
        if( $v != 0 )
        {
            my $s = $v < 0 ? -1 : 1 ;
            $v = log(abs($v))*$s;
            $datasets[$i]->[$j] = $v
        }
    }
}

The second picture shows the values after that transformation.
Now the question is: What possibilities do I have in CD to get the right (original) numbers on the axes - best would be something like:
-100,000,000;  -10,000; -1,000; -100; -10, -1; 0; 1; 10; ....

Regards
Sinan
demo1368778556.png
demo1368779180.png

  Re: Bubbles with log scales
Posted by sinan on May-17-2013 17:53
I found a similiar post "http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&pattern=scaling+callback&thread=1173063105#N1173072273"
which gave me the right idea - getTicks() + addLabel()

By the way I noticed the bubble distribution is better with exp instead of log:
for( my $i = 0; $i < @datasets;$i++)
{
    for(my $j = 0; $j < scalar(@{$datasets[$i]});$j++)
    {
        my $v = $datasets[$i]->[$j];
        my $s = $v < 0 ? -1 : 1 ;
        $v = pow(abs($v), 0.28);
        $v*=$s;
        $datasets[$i]->[$j] = $v
    }
}


Thank you for the splendit library!