Adrielpin / gchartphp

Automatically exported from code.google.com/p/gchartphp
0 stars 0 forks source link

Using extendedEncoding don't work #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi all,

What steps will reproduce the problem?
I create a chart and do not encode it. My chart is ok :
http://chart.apis.google.com/chart?&cht=lc&chs=1000x300&chco=ff3344&chxt=x,y&chm
=B,76A4FB,0,0,0&chd=e:AfAgAhAkAkAjAoAoAoAoAnApAqAoAqAqAlAdAjAjAjAiAdAYAeAXAXAWAW
AWAUAVAqApAnAm

The same chart with extended encoding ($lineChart->setEncodingType('e');) :
http://chart.apis.google.com/chart?&cht=lc&chs=1000x300&chco=ff3344&chxt=x,y&chm
=B,76A4FB,0,0,0&chd=e:AfAgAhAkAkAjAoAoAoAoAnApAqAoAqAqAlAdAjAjAjAiAdAYAeAXAXAWAW
AWAUAVAqApAnAm

The encoded values are not correct.

My code :
$lineChart = new gLineChart(1000,300);
$lineChart->setEncodingType('e');
$lineChart->addDataSet($data);
$lineChart->setColors(array("ff3344"));
$lineChart->setVisibleAxes(array('x','y'));
$lineChart->addLineFill(B,'76A4FB',0,0);

What's wrong with my code ?
$data is an array with my datas.
I need extended encoding because I can have values bigger then 100.

Best,

Alain

Original issue reported on code.google.com by alain.bo...@gmail.com on 15 Aug 2010 at 11:56

GoogleCodeExporter commented 8 years ago
Hi Alain,

when you encode your data with extended encoding, the new max value is 4095.
Our class takes care of "resizing" your data set based on your max value (if 
more than 100). Try to use it without encoding or with text encoding.

You can also use setDataRange to set min/max values different than 0/100.
Take a look at DataEncoding for more information.

Let me know if you have any more problems.

Original comment by bardellie on 16 Aug 2010 at 12:55

GoogleCodeExporter commented 8 years ago
Thank you for your reply.
So I tried adding $lineChart->addAxisRange(1, 0, 130); but it is not better.
The encoded values are too small. If real value is 40, encoded value is around 
1.
See the graph with encoded value :
http://chart.apis.google.com/chart?&cht=lc&chs=1000x300&chco=ff3344&chxt=x,y&chd
s=0,130&chxr=1,0,130&chm=B,76A4FB,0,0,0&chd=e:AfAgAhAkAkAjAoAoAoAoAnApAqAoAqAqAl
AdAjAjAjAiAdAYAeAXAXAWAWAWAUAVAqApAnAmAZAVAVAUATARAQARAPANAOAMAMANANALAOALAKAKAI
AMAKALALAIAHAHAIAHAIAHAHAHAGAIAGAGAGAIAHAFAGAGAGAJAHAHAHAHAIAHAHAJAJAJAKALAMANAP
AOAVAUAQARARATAUAVAYAYAUAZAbAcAeAeAiAmAnAtArAmAlAqAzAqAwApAnAnAnAoAsAxA2A8A9BCBC
BEA6A.A8BBA.A7A7A8A8A7A8A3A6A7BABDBNBNBKBQBP

without encoding, it works great. But if all my values are below 100 today, it 
can be more than 100 tomorrow (my graph displays the number of auditors of a 
webradio).

I read the DataEncoding page, but there is nothing more than adding the line 
with setEncoding('e')

Best,

Alain

Original comment by alain.bo...@gmail.com on 16 Aug 2010 at 12:40

GoogleCodeExporter commented 8 years ago
Hi again,

It works without encoding and with adding datarange. I don't understand why it 
works :-)

So I don't use extended encoding.

Best,

Alain

Original comment by alain.bo...@gmail.com on 16 Aug 2010 at 12:58

GoogleCodeExporter commented 8 years ago
I don't understand the encoding either. I think that it was introduced before 
the possibility of specifying the range for your data.

FYI, our php wrapper will scale your data set automatically if the maximum 
value is more than 100. Technically, you do not have to specify the data range. 
By doing so, you will lose some accuracy in your chart (i.e. if your data set 
is (456, 123, 542) it will be scaled as (83.13, 2.21, 100)) and you have to 
specify the axis range by hand. If you specify the data range, you don't have 
to worry about scaling but you have to remember to update your data range every 
once in a while (otherwise data points that exceeds your data set max will be 
truncated).

Let me know if you need any more help.
Best,
Emanuele

Original comment by bardellie on 16 Aug 2010 at 6:15