Controlling hover label of data point in Google Chart [duplicate] - google-visualization

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to change tooltip text for google chart api?
I am using Google Charts to create a line chart:
http://code.google.com/apis/chart/interactive/docs/gallery/linechart.html
I would like to control the text displayed when the user clicks or hovers over a datapoint. Currently the hover only shows the dataset name and value (same a Y-axis). I would like to display additional meta-data. Is this possible? Does someone have an example?

You could use "tooltip" in the dataTable roles:
data.addColumn('number', 'Abscisses');
data.addColumn('number', 'Warior');
data.addColumn({type:'number', role:'tooltip'});
data.addColumn({type:'string', role:'tooltip'});
data.addRow([2,3,4,'a']);
data.addRow([3,4,2,'b']);
Refers to:DataTable roles

Yes you do this by using the following code -
<code>
data.setFormattedValue(<your custom hover lable>);
</code>
Refer here:
http://code.google.com/apis/chart/interactive/docs/reference.html#DataTable_setFormattedValue

Related

Add label to horizontal line annotation in Superset chart

I see how to add a horizontal line to an Apache Superset chart, but can't figure out how to display the label on the chart. I want users to be able to see it without having to mouseover the chart.
Here's an example with the Games per Genre over time demo chart. My annotation:
That gets the line to display at 100, but its label - Target Number of Games - is not visible:
Is there a way to get the label to display just above or below its line?
Per a moderator in the Apache Superset Slack message board, this is not currently possible as of v1.5.0.

Chart.js HTML custom legend issues with doughnut chart

I'm working with chart.js and I followed this to create a custom HTML legend.
The thing is, the hide/show functionality is not working. The first legend click hides the whole chart, while the others produce the error:
Uncaught TypeError: Cannot read property '_meta' of undefined
at t.getDatasetMeta (Chart.min.self-b26766dbef822c075056eb7012dc36ae75970dc990497732f927d46ef6070858.js:11)
at HTMLLIElement.legendClickCallback (plot.self-416475a747a420b91c7fab454c07846f1043f55cc28f6d810fafeab61c56cf01.js:317)
so it traces back to t.getDatasetMeta.
I gotta say it's working great with line/bar charts, so its only my doughnut chart which breaks.
Let me know if you need more info.
Oh and thanks :P
EDIT: fiddle
The problem is that you have only one dataset and your code use the index of legend item clicked to hide datasets[index].
On the contrary you need to hide single item data as below:
var meta = chart.getDatasetMeta(0);
var item = meta.data[index];
Check the fiddle updated: https://jsfiddle.net/beaver71/aa2n39s2/

How to rename list of Excel sheets with a list of names [duplicate]

This question already has answers here:
Creating and Naming Worksheet in Excel VBA [closed]
(3 answers)
Closed 7 years ago.
I need to create profiles for a large list of clients. Each client has an ID number and I need to create a sheet in a workbook for each client, with the ID number for each client as the name for their respective sheets. I also have a sheet template that I would rather use to help create profiles in a uniform and professional manner. My question is: is there a way I can create a copy of the template for each of my clients and rename them with each of the ID's on my list, all at once?
The following VBA commands should cover what you want to do:
Rename a sheet
Sheets("Sheet5").Name = "Myname"
Add a sheet, then rename it
Sheets.Add
Sheets(ActiveSheet.Name).Name = "MyNewSheet"

Hide tooltip for Google Visualization API GeoChart

I am creating a markers-based Geochart to display the location of schools. I have my data in a Google docs spreadsheet. I'm using 3 columns: lat, long and marker size. Currently, the tooltips display lat and long. Ideally, they would display information about each school instead but removing them would be fine, too. See what I have so far on jsfiddle.
Some of the other Google visualizations seem to allow a trigger:'none' option for tooltip (e.g., Pie Chart). Am I correct that there is no such thing for GeoChart?
It seems there's an experimental feature that allows assigning a tooltip role to a particular data column. I tried to use that to no avail.
I tried finding and hiding the tooltip div but I couldn't figure out how to access any elements in the iframe that contains the map. I'd be perfectly happy with this kind of solution if I could get it to work!
I realize this is not exactly what Geochart seems meant for but I'm using other Geochart region maps on the same page and would like to keep the same aesthetic.
I know this is an old question, but maybe it can still help.
Check out this example:
data.addColumn('number', 'Lat');
data.addColumn('number', 'Long');
data.addColumn('string','tooltip');
data.addColumn('number','Example');
data.addRows([[41.151636,-8.569336,'Portugal',{v:0,f:'test PT'}]]);
data.addRows([[ 39.059575,-98.789062,'USA',{v:1,f:'test US'}]]);
You can now also disable the tooltip adding, which was not previously available:
tooltip.trigger:'none';
Here is an example: http://jsfiddle.net/cmoreira/njB6m/

Google Chart - Show Data Annotations on Points - Interactive Line Chart

I need to show data points on the line chart, i.e. which appear on mouse over at a point, i need them all displayed by default i.e. not by mouse over. Any clues?
You can use
data.addColumn({type: 'string', role: 'annotation'});
and add one more value at the time of adding record with data.addRows of type string.
That will be shown just above the point on chart.
Thanks!