3D Pie Chart, Triggering a Tooltip on chart init - google-visualization

Is there anyway to trigger a mouseover event for a specific pie chart slice that will that slice's tooltip appear through the "ready" event?
My code right now is as follows:
google.visualization.events.addListener(google_chart, 'ready', function () {
google_chart.setSelection([{row: 0, column: null}]);
});
setSelection() doesn't appear to trigger the tooltip.
I am using Google charts on a mobile web app and want to avoid using legends so that the chart has the most amount of real estate possible.

I am afraid there is no way to trigger the built-in tooltip on init. However you can hook-up a custom tooltip component which triggers at startup.

Related

Apexcharts: radar chart click event on xAxis label

SEE PICTURE I'm using apexcharts for displaying a radar chart. I want to trigger an event when the user clicks on one of the categories of the radar (see image), but the event doesn't seem to be triggered. I have read the documentation and used, between all the events, the xAxisLabelClick event, which seems to work for the other charts. Does anyone know how?
I have tried all the apexcharts events, but none of the work
Apparently it's a bug. I've just filled an issue.

How to force redraw ApexCharts?

I'm updating ApexCharts using updateSeries while the chart is hidden using display: none. When the series is being updated I think it is checking the width of the element that it is wrapped in. When hidden, the width is considered 0 and therefore the width of the chart is set to 0. I want to force redraw the chart when it is visible but I found nothing in the docs.
PS: The chart restores to its original size when I resize the window.
I don't know weather it will be help you or not I have same issue using with apex chart some lables and title was missing but when you resize the window it will automatically redraw the chart because apexchart have this property by default
chart: {
redrawOnWindowResize: true
}
I have try this this put chart render method inside timeout function and it works for me
setTimeout(() => {
chart.render();
},2000)
In my case, it seems like chart rending before getting style of parent component
Try this.
window.dispatchEvent(new Event('resize'));

ChartJS doughnut - Multi line label with click event listener

I am using ChartJS library to render the doughnut chart. I have custom labels to show with the event listener. I tried by using chartjs-plugin-datalabels and chartjs-plugin-labels, but no luck maybe I am not an expert in CSS.
The final doughnut is should be like:
Can anyone have any other suggestions to solve this?

ChartJS: Show default tooltip onclick

I have a chart.js line chart displaying properly. When you hover over the y-axis gridlines, the tooltips display as they should.
I'm trying to convert this to function on a touchscreen, so there is no hover. Is there a way to add a simple parameter to make the tooltip show on both hover and onclick?
Note, I know I could add a custom tooltip and add all of that functionality - I'm trying to see if there's just a parameter I can add as I don't need a custom tooltip.
For Chart.js v2, you can specify those events at the root level of chart options.
options: {
events: ['click']
}
Just add "click" to your tooltipEvents list when specifying the options for the chart
...
tooltipEvents: ["mousemove", "touchstart", "touchmove", "click"],
});
In the fiddle below, I've removed all other events from the list except for click to give you an idea of how it will be like on a mobile
Fiddle - http://jsfiddle.net/8uobybv3/
For ChartJS version 2.8.0, you will need to add both the click and mouseout events to make the tooltip behave the desired way.
The click event would make the tooltip to appear when point is clicked and the mouseout event would hide the tooltip when the mouse pointer is moved outside of the chart canvas area which is the desired behavior.
Note: Without adding the mouseout event the tooltip would not hide even when the mouse is moved or clicked outside the chart canvas area.
Code:
options: {
events: ["click", "mouseout"],
....
...

How to Add Data Labels in Google Chart

I have created a bar chart using google spreadsheet. I just want to ask how I can put data labels (just like in Excel) to show the value of each bar. Is there a way to do that without using a script? Thank you
If you click on the chart itself, or during creation of the chart, you will be greeted with the "Chart Editor" window. In the top of the window there will be three tabs, from left to right: Recommendations, Chart Type, Customization. Under the Customization Tab if you scroll down to the very bottom, in between the "Point Shape" drop down menu and the "Error Bars" drop down menu, there is a drop down menu named "Data Labels" simple change the default of "none" to "Value" and wha-la labels.
To get labels for both X and Y coordinates simply scroll up to the "Axis" drop down menu (this is still under the customization tab) and switch the Axis from Horizontal to Vertical, or vise versa and repeat the above steps.