On mouse_over linecharts google visualizaton

27 views
Skip to first unread message

ita...@adgorithms.com

unread,
Jan 18, 2013, 6:45:02 AM1/18/13
to google-visua...@googlegroups.com
Hi,
I've a strange bug.
I'm building a linechart on google visualization using datasource.
The drawing of the chart works great,
but when I mouse over certain metrics in my line, the value is not presented with the real metrics values.
For example, I attached a printscreen, where you can see that the value presented for imps for 1/5/13 is 923, where it actually 23,344,122.

Here is the part of my code that I'm actually drawing the line chart:

================================================
var options = {
width: 600, height: 400,
        vAxes: { 0: {format: "#,###"}, 
     1: {format: "#,###"} 
   },
        series: {
            0:{targetAxisIndex: 0 },
            1: {targetAxisIndex: 1}
        }
    };

      visualization = new google.visualization.LineChart(document.getElementById('visualization'));
      visualization.draw(data,options);
=================================================

Any ideas why?

Thanks.
chart.jpg

ita...@adgorithms.com

unread,
Jan 18, 2013, 6:47:34 AM1/18/13
to google-visua...@googlegroups.com
chart.jpg

asgallant

unread,
Jan 18, 2013, 11:21:39 AM1/18/13
to google-visua...@googlegroups.com
If you post your source code I'll take a look and see what might be the problem.

Itamar Yoniso

unread,
Jan 18, 2013, 11:42:24 AM1/18/13
to google-visua...@googlegroups.com
It a little bit long, because it helds a lot of calculations on my data table.
But after all the calculations I print all the elements from the data table and the values are correct.
Also, the values on the y axis are good after drawing. Only the on mouse over values not correct.

I've posted all the code that deals with my data table after all the calculations in the first message.
Maybe it because I'm not define the options correctly? Am I missing something there?

Thanks again


--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/tKogZKkzH24J.

To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

asgallant

unread,
Jan 18, 2013, 12:03:02 PM1/18/13
to google-visua...@googlegroups.com
The tooltip values are determined by the values in the DataTable, so somewhere along the way you are setting the formatted value of the cells to the wrong value.
To unsubscribe from this group, send email to google-visualization-api+unsub...@googlegroups.com.

Itamar Yoniso

unread,
Jan 18, 2013, 12:10:30 PM1/18/13
to google-visua...@googlegroups.com
Thanks.
You are right, I have lots of lines in a for loop that goes like this:
data.setValue(i-1,j,((totalRevenues/impressions)*1000));

How do I set also the formatted value of cell?
Maybe I need to use setCell instead of setValue?




To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.

asgallant

unread,
Jan 18, 2013, 12:51:39 PM1/18/13
to google-visua...@googlegroups.com
You can use the setCell method, which would allow you to specify whether or not to overwrite the formatted value of the cell:

data.setCell(row, column, value, undefined); // keep the formatted value as is
data.setCell(row, column, value, null); // use the new value to create the formatted value
data.setCell(row, column, value, formattedValue); // specify the formatted value yourself


To unsubscribe from this group, send email to google-visualization-api+unsubscr...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Itamar Yoniso

unread,
Jan 18, 2013, 5:16:48 PM1/18/13
to google-visua...@googlegroups.com
Awesome!!
Thanks Drew! I've changed it to null and now it works.
One last question: Do you know how can I set the number of values on my y axis, so it won't duplicate values like in my attached screenshot?

Thanks again


To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
chart.jpg

Itamar Yoniso

unread,
Jan 18, 2013, 5:26:13 PM1/18/13
to google-visua...@googlegroups.com
Never mind, I found it!
I added vaxes gridlines.count in my options. 

Thanks again for your help
Reply all
Reply to author
Forward
0 new messages