The issue you had with IE8 is not the getElementById method, it is that IE8 
doesn't propagate some changes in the javascript object back to the HTML 
element (try, for instance, changing a checkbox to a radio button in IE8).

That said, I don't see anything in your code that would cause the charts to 
fail in IE8.  The only problem I see is in your selectHandler function, on 
this line:

var selectedItem = chart.getSelection()[0];

This will throw an error when the user deselects an element in the chart, 
causing #getSelection to return an empty array, which you cannot access 
element 0 in.  The proper way to handle this is to get the selection and 
test its length:

var selection = chart.getSelection();
if (selection.length) {
    var selectedItem = selection[0];
}

or loop over the selection if you have multi-select enabled on your chart 
(it is disabled by default on most charts).

For fixing your immediate problem, I suggest using IE9's debugger, and 
enabling IE8 emulation to see if you can catch the problem that way.

On Monday, December 9, 2013 5:04:49 AM UTC-5, Rita wrote:
>
> Thank you for replying.
> Maybe the term "bug" is not "correct" but In some case I've found problems 
> in IE8 with document.getElementById and I solved them using jquery. In 
> particular it was in case of assign a particular value to a <a href> tag 
> inside a jdialog open on clicking rows of DataTable.
> Using document.getElementById IE8 :
>
> document.getElementById('linkCat').href = value;
>
> it did not apply this special value, instead using this:
>
> $("#linkCat").attr("href", value);
>
> it works.
> I saw that other people had found similar problem (so I write my solution 
> in case can help someone).
>
> However my priority is solve the visualization of charts. I use this code:
>
> function getCombo(flag, sel) {
>     var value;
>     if (flag==0){        
>         value = sel.options[sel.selectedIndex].value; 
>     }else{  
>         value = flag;
>     }
>    
>     if (value == 1) {
>      chart = new 
> google.visualization.PieChart(document.getElementById('chart_div'));       
>         chart_options = {//'title': jsonData.chart.title + " " + 
> jsonData.chart.info,            
>             'is3D': true,
>             'fontSize': 12,
>             'legend': {position: 'left', alignment: 'center'},
>             'pieResidueSliceLabel': 'Altre',
>             'chartArea':{height:'100%'}
>         };
>     } else if (value == 2) {
>         chart = new 
> google.visualization.BarChart(document.getElementById('chart_div'));
>         chart_options = {//'title': jsonData.chart.title + " " + 
> jsonData.chart.info,
>             'fontSize': 12,
>             'height': Math.max(chart_height, (chart_data.getNumberOfRows() 
> * 20))
>         };
>     } else if (value == 3) {
>         chart = new 
> google.visualization.ColumnChart(document.getElementById('chart_div'));
>         chart_options = {//'title': jsonData.chart.title + " " + 
> jsonData.chart.info,
>             'fontSize': 12
>         };
>     } else if (value == 4) {
>         chart = new 
> google.visualization.LineChart(document.getElementById('chart_div'));
>         chart_options = {
>             'fontSize': 12
>         };
>     } else if (value == 5) {
>         chart = new 
> google.visualization.AreaChart(document.getElementById('chart_div'));
>         chart_options = {
>             'fontSize': 12
>         };
>     }
>
>     function selectHandler() {
>         var selectedItem = chart.getSelection()[0];
>         if (selectedItem) {
>             
>             var topping = chart_data.getFormattedValue(selectedItem.row, 
> 0);           
>             $("#linkCat").text(topping + " : Visualizza");
>             var pv = $("input#pvslice").val();
>             var data1 = $("input#data1slice").val();                    
>             var data2 = $("input#data2slice").val();           
>             $("#linkCat").attr("href", jsonData.chart.link + topping + 
> "&PV=" + pv + "&data1=" + data1 + "&data2=" + data2);
>             $("#dialogSlice").dialog("open");            
>         }
>     }
>
>     google.visualization.events.addListener(chart, 'select', 
> selectHandler);
>     chart.draw(chart_data, chart_options); 
> };
>
>
> Rita
>
>
> Il giorno venerdì 6 dicembre 2013 17:33:08 UTC+1, asgallant ha scritto:
>>
>> Post your code and I will take a look.
>>
>> FYI, there are no problems in IE8 with document.getElementById
>>
>> On Friday, December 6, 2013 11:26:00 AM UTC-5, Rita wrote:
>>>
>>> Thank you,
>>> I had read about this possible cause in another discussion on this group 
>>> so I've already checked. The code is OK.
>>> I've changed
>>> chart = new 
>>> google.visualization.PieChart(document.getElementById('chart_div'));
>>> with
>>> chart = new google.visualization.PieChart($("#chart_div")[0]);
>>>
>>> because of IE8 sometimes have problem with method getElementById, but 
>>> nothing is changed.
>>> Any other suggestion, please?
>>>
>>> Rita
>>>
>>>
>>> Il giorno venerdì 6 dicembre 2013 17:01:45 UTC+1, asgallant ha scritto:
>>>>
>>>> Usually when the charts work in other browsers but not IE8, it is due 
>>>> to an errant comma at the end of an array or object, eg:
>>>>
>>>> var myArray = ['foo', 'bar',];
>>>> var myObject = {foo: 'bar',};
>>>>
>>>> Check your code to make sure you don't have any commas like that.
>>>>
>>>> On Friday, December 6, 2013 5:29:54 AM UTC-5, Rita wrote:
>>>>>
>>>>> Hi everybody,
>>>>> I'm developing a web application which use Google Chart Tools. I 
>>>>> attach this library with the following instruction:
>>>>>
>>>>> google.load('visualization', '1.0', {'packages': ['corechart', 
>>>>> 'table']});
>>>>>
>>>>> I don't have problem of rendering on all browser, except IE8 on which 
>>>>> charts are not displayed! DataTable are ok but charts are not show. I 
>>>>> cannot display them.
>>>>> Could someone suggest me a solution please?
>>>>> I've tried to add:
>>>>>
>>>>> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
>>>>>
>>>>> but nothing change.
>>>>>
>>>>> Thanks in advance.
>>>>>
>>>>> Regards
>>>>> Rita
>>>>>
>>>>

-- 
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