Oh, and consider that super-wishlisty.  I'm sure you guys have much better 
things to do with the API than indulge my chart fantasies.

On Tuesday, August 13, 2013 12:31:43 PM UTC-4, asgallant wrote:
>
> I would love for there to be a way to pull metadata from the chart about 
> things like the axes, labels, element positions, and element sizes (eg, 
> where are the top and left edges of this bar, how wide is it, how tall is 
> it?  What are the pixel coordinates of this point on a line?  What are the 
> axis tick marks, and what are their y-axis pixel coordinates?).  Some of 
> this information I can tease out of the SVG, but I don't like to do that, 
> knowing that updates to the API can make subtle changes in the SVG 
> structure that break the parsing code (not to mention the cross-browser 
> issues with trying to parse the same information out of VML).
>
> On Tuesday, August 13, 2013 12:18:09 PM UTC-4, Daniel LaLiberte wrote:
>>
>> Luke,
>>
>> I can see that it would be useful to find out what the chart is doing so 
>> you can process things like the axis bounds in other contexts, but there is 
>> no way to do that currently, unless you query the generated display 
>> elements (which is generally not recommended).  We are thinking about ways 
>> to expose such information with a general capability, so we are open to 
>> suggestions.
>>
>> dan
>>
>>
>> On Mon, Aug 12, 2013 at 10:51 PM, Luke Bellamy <[email protected]>wrote:
>>
>>> Daniel,
>>> Just wanted to throw out an idea. If I can programatically get the min, 
>>> max, interval values for the axis itself (not the data) that was rendered, 
>>> I could effectively give the image charts a "hint".
>>> So after the draw() method I could say, now give me the axis values you 
>>> are using. Then fire off my ajax request to generate the corresponding 
>>> image charts.
>>>  
>>> I had a little play but could not see the method to get that information 
>>> from the 'google.visualization.ComboChart' object.
>>> Is it possible?
>>>  
>>> Thankyou,
>>> Luke
>>>  
>>>
>>> On Tuesday, August 13, 2013 9:59:01 AM UTC+10, Luke Bellamy wrote:
>>>
>>>> Hi,
>>>> I'm using google charts (basic combo chart) on a web site. Awesome, no 
>>>> problem with that. I wish to put this into a PDF. So what I did was using 
>>>> the deprecated image charts to generate an image using the same data and 
>>>> making them look the same. Works great.
>>>>  
>>>> My issue is that the vertical axis intervals, min, and max are not the 
>>>> same. I understand why and I prefer the 'pretty' axis scaling in google 
>>>> charts. So I thought I would come up with an algorithm myself using the 
>>>> min 
>>>> and max from the data to come up with the range and intervals. This is for 
>>>> the old image charts. Works very well, but in a couple of scenarios I can 
>>>> see it's not EXACTLY the same, although close. Note that these are very 
>>>> basic charts so I'm not doing anything fancy. It would just be nice if 
>>>> they 
>>>> looked identical.
>>>>  
>>>> My question is, can I find the axis range and interval algorithm from 
>>>> google charts somewhere? I did see the google visualization java code 
>>>> available but code not find what I was after.
>>>> Here is the basic bit of code I have been tweaking in JAVA for image 
>>>> charts to mirror the axis algorithm of google charts.
>>>>  
>>>> // Take the Max/Min of all data values in all graphs
>>>> var totalMax = 345;
>>>> var totalMin = -123;
>>>>
>>>> // Figure out the largest number (positive or negative)
>>>> var biggestNumber = Math.max(Math.abs(totalMax),**Math.abs(totalMin));
>>>>
>>>> // Round to an exponent of 10 appropriate for the biggest number
>>>> var roundingExp = Math.floor(Math.log(**biggestNumber) / Math.LN10);
>>>> var roundingDec = Math.pow(10,roundingExp);
>>>>
>>>> // Round your max and min to the nearest exponent of 10
>>>> var newMax = roundHalfUp(totalMax/**roundingDec)*roundingDec;
>>>> var newMin = roundHalfDown(totalMin/**roundingDec)*roundingDec;
>>>>
>>>> // Determine the range of your values
>>>> var range = newMax - newMin;
>>>>
>>>> // Define the number of gridlines (default 5)
>>>> var gridlines = 5;
>>>>
>>>> // Determine an appropriate gap between gridlines
>>>> var interval = range / (gridlines - 1);
>>>>
>>>> // Round that interval up to the exponent of 10
>>>> var newInterval = roundHalfUp(interval/**roundingDec)*roundingDec;
>>>>
>>>> // Re-round your max and min to the new interval
>>>> var finalMax = Math.ceil(totalMax/**newInterval)*newInterval;
>>>> var finalMin = Math.floor(totalMin/**newInterval)*newInterval;
>>>>  
>>>>  
>>>>  
>>>> Thankyou,
>>>> Luke
>>>>
>>>  -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Google Visualization API" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at 
>>> http://groups.google.com/group/google-visualization-api.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>>
>> -- 
>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> 
>>  - 978-394-1058
>> [email protected]   562D 5CC, Cambridge MA
>> [email protected] 9 Juniper Ridge Road, Acton MA
>>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to