i tried using the following bit of code, to achieve the desired results

function rangechange_handler(e) {
//find start & end date
var start = e.start;
var end = e.end;
document.getElementById("s1").innerHTML = start;
// price of stock 1 on start date
var b1 = data.getValue(data.getFilteredRows([{column: 0, minValue: 
start}])[0], 1);
// price of stock 2 on start date
var b2 = data.getValue(data.getFilteredRows([{ column: 0, minValue: 
start}])[0], 2); 
// create a view
var view = new google.visualization.DataView(data); 
// Set column values
view.setColumns([0, {
type: 'number',
label: '<?php echo $SymbolID; ?>',
calc: function(dataTable, rownum) {
return Math.round(dataTable.getValue(rownum,1)*100/b1)/100;
}},
{
type: 'number',
label: '<?php echo $SymbolID1; ?>',
calc: function(dataTable, rownum) {
return Math.round(dataTable.getValue(rownum,2)*100/b2)/100;
}}]);
var ready = google.visualization.events.addListener(chart, 'ready', 
function () {
            chart.setVisibleChartRange(start, end);
            google.visualization.events.removeListener(ready);
});
chart.draw(view, options);

}

this i 'think' is working.. but is causing the page to freeze. I suspect 
because of the re-calculation under setColumn. I get the following error:

"maximum call stack size exceeded"

any thoughts?

On Thursday, 21 April 2016 09:37:02 UTC+5, Shamoun Ilyas wrote:
>
> That is what i am trying to do with little luck. Going back to the 
> database is inefficient.
>
> On Wednesday, 20 April 2016 22:54:49 UTC+5, Daniel LaLiberte wrote:
>>
>> It would be better, faster anyway, if you could do the recomputation in 
>> the browser, probably by generating a DataView.  For each changerange 
>> event, generate the new data and call draw() on the chart again.  If this 
>> ends up being slow, I have some ideas on how to speed it up.
>>
>> On Wed, Apr 20, 2016 at 12:55 PM, Shamoun Ilyas <sha...@gmail.com> wrote:
>>
>>> thank you daniel for the solution re: the zoom buttons.
>>>
>>> Yes, i have read on the group that others have requested similar feature 
>>> before. I saw this old thread, where an event handler was used to get the 
>>> desired result in Annotation Timeline chart. Thought maybe a similar work 
>>> around could be done in the AnnotationChart
>>>
>>> Recomputing the data would only work correctly if somehow i could query 
>>> back my MySQL database based on my range selector. I don't if a date 
>>> parameter can be passed from range selector to the database?
>>>
>>>
>>>
>>> On Wednesday, 20 April 2016 20:58:57 UTC+5, Daniel LaLiberte wrote:
>>>>
>>>> Here is the change of the zoom buttons:  
>>>> https://jsfiddle.net/dlaliberte/4gdzcLLm/2/
>>>>
>>>> To get the scaling you want relative to the first y-axis value, you 
>>>> would have to recompute the data yourself.  But then that would not work 
>>>> correctly with the range selector, which assumes the data is static.  
>>>>
>>>> Others have requested a similar feature, where multiple series are all 
>>>> rescaled to be relative to the first value, so you can see the changes 
>>>> relative to that common starting point. It would be a useful feature to 
>>>> support, but it is not possible today, not without changing the data 
>>>> yourself.
>>>>
>>>>
>>>> On Wed, Apr 20, 2016 at 10:27 AM, Daniel LaLiberte <dlali...@google.com
>>>> > wrote:
>>>>
>>>>> Here is your code working: https://jsfiddle.net/dlaliberte/4gdzcLLm/1/
>>>>> You have to change the jsfiddle hidden feature under the javascript 
>>>>> configuration button so that it doesn't run onload.
>>>>> Your requested features are probably doable, and I'll update in an 
>>>>> hour.
>>>>>
>>>>> On Wed, Apr 20, 2016 at 10:18 AM, Shamoun Ilyas <sha...@gmail.com> 
>>>>> wrote:
>>>>>
>>>>>> here you go
>>>>>>
>>>>>> https://jsfiddle.net/shamoun/4gdzcLLm/
>>>>>>
>>>>>> 1. Need to get rid of the 1h, 1d & 5d buttons
>>>>>> 2. I want the values to be a % of the first y-axis value of the 
>>>>>> graph. So when we access the 'rangechanger', the first value should 
>>>>>> dynamically change to 1.
>>>>>>
>>>>>> Thanks for your help
>>>>>>
>>>>>> On Wednesday, 20 April 2016 18:37:08 UTC+5, Daniel LaLiberte wrote:
>>>>>>>
>>>>>>> Hi Shamoun,
>>>>>>>
>>>>>>> Can you give us a link to your page so we can see what is going on?
>>>>>>>
>>>>>>> The other thread you linked to discusses several things.  Which 
>>>>>>> thing are you interested in?  The AnnotationChart should be a drop-in 
>>>>>>> replacement for the AnnotatedTimeline, however, so try it.
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Apr 20, 2016 at 9:10 AM, Shamoun Ilyas <sha...@gmail.com> 
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Daniel,
>>>>>>>>
>>>>>>>> I wasnt able to access the undocument options re; Zoom Buttons that 
>>>>>>>> you suggest. Can you help me out there with the code.
>>>>>>>>
>>>>>>>> Also, I am trying to implement something similar to this thread
>>>>>>>>
>>>>>>>> https://groups.google.com/forum/#!searchin/google-visualization-api/annotated$20charts$20index$20date/google-visualization-api/Vz2YAHVOx_E/0TTkRccRqkgJ
>>>>>>>>
>>>>>>>> but that was done with the Annotated Timeline Chart. I was not able 
>>>>>>>> to replicate the desired effect with the AnnotationChart. Is it 
>>>>>>>> possible to 
>>>>>>>> do through an event handler like they have done?
>>>>>>>>
>>>>>>>> Thanks again for your help.
>>>>>>>>
>>>>>>>> On Friday, 15 April 2016 15:54:42 UTC+5, Daniel LaLiberte wrote:
>>>>>>>>>
>>>>>>>>> Hi Shamoun,
>>>>>>>>>
>>>>>>>>> As a matter of fact, the Dashboard 'bind' feature is used 
>>>>>>>>> internally in AnnotationChart.  It was actually implemented as a 
>>>>>>>>> Dashboard 
>>>>>>>>> first, and then wrapped with a chart API.  And we have been thinking 
>>>>>>>>> about 
>>>>>>>>> how to do that kind of wrapping more easily using a ChartWrapper.
>>>>>>>>>
>>>>>>>>> There are a couple of undocumented options regarding the zoom 
>>>>>>>>> buttons, if you want to customize them:  
>>>>>>>>> https://groups.google.com/d/msg/google-visualization-api/pzZoRUn5oLA/RQs6RSeJXr4J
>>>>>>>>>
>>>>>>>>> Enjoy.
>>>>>>>>>
>>>>>>>>> On Fri, Apr 15, 2016 at 1:20 AM, Shamoun Ilyas <sha...@gmail.com> 
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Also, if you could advise- it is possible to remove the 1h & 1d 
>>>>>>>>>> zoom buttons from the chart and leave the remaining? Thanks
>>>>>>>>>>
>>>>>>>>>> On Friday, 15 April 2016 09:58:07 UTC+5, Shamoun Ilyas wrote:
>>>>>>>>>>>
>>>>>>>>>>> Thank you Daniel for you reply. Thanks i will try the volume 
>>>>>>>>>>> chart on a different vertical axis. Ideally, I was looking for a 
>>>>>>>>>>> whole 
>>>>>>>>>>> separate chart within the AnnotationChart- something like the 
>>>>>>>>>>> 'bind' 
>>>>>>>>>>> feature you have in ChartWrapper. Thanks once again.
>>>>>>>>>>>
>>>>>>>>>>> On Friday, 15 April 2016 00:45:00 UTC+5, Daniel LaLiberte wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> The main chart in the AnnotationChart is actually just a 
>>>>>>>>>>>> ComboChart.  You can give it options under a 'chart' option.  You 
>>>>>>>>>>>> can 
>>>>>>>>>>>> target a different vertical axis for the volume chart, and arrange 
>>>>>>>>>>>> that it 
>>>>>>>>>>>> shows up mostly in the bottom area.  But you can't add a whole 
>>>>>>>>>>>> separate 
>>>>>>>>>>>> chart within the AnnotationChart, though that would be a good idea.
>>>>>>>>>>>>
>>>>>>>>>>>> On Thu, Apr 14, 2016 at 3:51 AM, Shamoun Ilyas <
>>>>>>>>>>>> sha...@gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> I am trying to figure out if it is possible to make a stock 
>>>>>>>>>>>>> price (chart type: line) & volume (chart type: column to area)- 
>>>>>>>>>>>>> with the 
>>>>>>>>>>>>> chart range filter at the bottom. Not been able to figure it as 
>>>>>>>>>>>>> yet. Is it 
>>>>>>>>>>>>> even possible? Any help would be appreciated. Thanks.
>>>>>>>>>>>>>
>>>>>>>>>>>>> -- 
>>>>>>>>>>>>> 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 
>>>>>>>>>>>>> google-visualization-api+unsubscr...@googlegroups.com.
>>>>>>>>>>>>> To post to this group, send email to 
>>>>>>>>>>>>> google-visua...@googlegroups.com.
>>>>>>>>>>>>> Visit this group at 
>>>>>>>>>>>>> https://groups.google.com/group/google-visualization-api.
>>>>>>>>>>>>> To view this discussion on the web visit 
>>>>>>>>>>>>> https://groups.google.com/d/msgid/google-visualization-api/8e1467a3-889b-4f62-aae2-19ea94cc5255%40googlegroups.com
>>>>>>>>>>>>>  
>>>>>>>>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/8e1467a3-889b-4f62-aae2-19ea94cc5255%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>>>>> .
>>>>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> -- 
>>>>>>>>>>>> Daniel LaLiberte 
>>>>>>>>>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>>>>>>>>>> dlali...@google.com   5CC, Cambridge 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 
>>>>>>>>>> google-visualization-api+unsubscr...@googlegroups.com.
>>>>>>>>>> To post to this group, send email to 
>>>>>>>>>> google-visua...@googlegroups.com.
>>>>>>>>>> Visit this group at 
>>>>>>>>>> https://groups.google.com/group/google-visualization-api.
>>>>>>>>>> To view this discussion on the web visit 
>>>>>>>>>> https://groups.google.com/d/msgid/google-visualization-api/8b95ced3-4768-42fb-8af8-1c0ee0e7e2c7%40googlegroups.com
>>>>>>>>>>  
>>>>>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/8b95ced3-4768-42fb-8af8-1c0ee0e7e2c7%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>>>> .
>>>>>>>>>>
>>>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>> Daniel LaLiberte 
>>>>>>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>>>>>>> dlali...@google.com   5CC, Cambridge 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 
>>>>>>>> google-visualization-api+unsubscr...@googlegroups.com.
>>>>>>>> To post to this group, send email to 
>>>>>>>> google-visua...@googlegroups.com.
>>>>>>>> Visit this group at 
>>>>>>>> https://groups.google.com/group/google-visualization-api.
>>>>>>>> To view this discussion on the web visit 
>>>>>>>> https://groups.google.com/d/msgid/google-visualization-api/518a4381-ca45-49a3-99a9-de2182dcadef%40googlegroups.com
>>>>>>>>  
>>>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/518a4381-ca45-49a3-99a9-de2182dcadef%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>>> .
>>>>>>>>
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -- 
>>>>>>> Daniel LaLiberte 
>>>>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>>>>> dlali...@google.com   5CC, Cambridge 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 
>>>>>> google-visualization-api+unsubscr...@googlegroups.com.
>>>>>> To post to this group, send email to google-visua...@googlegroups.com
>>>>>> .
>>>>>> Visit this group at 
>>>>>> https://groups.google.com/group/google-visualization-api.
>>>>>> To view this discussion on the web visit 
>>>>>> https://groups.google.com/d/msgid/google-visualization-api/dadfd891-4570-4785-8c04-7fd75d9e9470%40googlegroups.com
>>>>>>  
>>>>>> <https://groups.google.com/d/msgid/google-visualization-api/dadfd891-4570-4785-8c04-7fd75d9e9470%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>> .
>>>>>>
>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> -- 
>>>>> Daniel LaLiberte 
>>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>>> dlali...@google.com   5CC, Cambridge MA
>>>>>
>>>>
>>>>
>>>>
>>>> -- 
>>>> Daniel LaLiberte 
>>>> <https://plus.google.com/100631381223468223275?prsrc=2>
>>>> dlali...@google.com   5CC, Cambridge 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 google-visualization-api+unsubscr...@googlegroups.com.
>>> To post to this group, send email to google-visua...@googlegroups.com.
>>> Visit this group at 
>>> https://groups.google.com/group/google-visualization-api.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/google-visualization-api/886a552b-4e8a-442f-a6f1-271eec3b390a%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/google-visualization-api/886a552b-4e8a-442f-a6f1-271eec3b390a%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
>> dlali...@google.com   5CC, Cambridge 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 google-visualization-api+unsubscr...@googlegroups.com.
To post to this group, send email to google-visualization-api@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/431297bf-fa57-4fc1-8f48-5deb58609735%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to