Google Charts Api Multiple charts in the same canvas - javascript

I am using google charts api. It is perfect for my needs. I am now trying to incorporate multiple pie charts in the same page. I have moved the charts to the bottom of the page. How to add four pie charts in the same canvas or should I create multiple canvas on the same page.
var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
I appreciate any help.

Do not understand what you means by canvas. But if you've 4 Google charts, each chart can be displayed in its own DIV. So you'll need 4 'chart_div'. For example, this is how the Web Reporting of icCube is working.

Related

How to highlight a portion of Google Bar Charts determined by category filter?

I'm wanting to replicate a bar chart done in Power BI using google charts, and one of the features I am attempting to implement is this filter effect as shown by the two pictures I've attached a link to.
Bar Chart Before Filtering
Bar Chart After Filtering
I can add example data in a reply if necessary, but the concept is that the bar chart before shows 100% of data made up of sub categories, and on selecting a category from a drop down menu, the percentage coming from that sub category is highlighted while the rest is made transparent. I've searched through the Google Charts documentation and previous questions however I haven't found any information on how to implement this or if this effect is even possible. The controls included in the API seem to only be able to redraw the chart entirely, not keep the chart and highlight the portion filtered.
I've considered having two charts overlaid on top of each other, with the chart on top changing based on the user category selection and the chart on bottom remaining static, however, I'm not sure if that implementation is optimal or possible. Ideally, I would also be able to replicate this effect on other categorical based charts, such as a pie chart. I'm wondering if anyone has any ideas on a workaround in order to create a similar effect, or some input on whether this effect is even possible using the google charts API and JavaScript/HTML/CSS.

Drawing In my Charts using amcharts

I can’t draw in my charts using drawingIconsEnabled
i need to draw in my charts an make markup
Link my code :plnkr.co/edit/uKdqrGvMHaAx7wixax5m?p=preview
drawingIcontsEnabled is a stock chart feature, not a serial chart feature. You have to use the stock charts library instead if you need drawing functionality. Look at this demo on AmCharts' site to see how it's implemented and change your code accordingly.
Note that stock charts only work with date-based data. String-based categories will not work.
The user can also enable annotations in the export menu if they want to draw on the chart as well. This works in both stock and non-stock charts.

How to put pie charts on a SVG map?

I use such a map on my website, it's created by amCharts:
All regions are SVG path elements. I'm thinking how to put a chart.js (or any other) pie chart on each of them. The chart of chart.js is a canvas element. Is there any easy solution to achieve it? I could also change the map provider if neccessary.
This should be the effect:
There's a demo on the AmCharts website that shows how to do that. You essentially need to create image markers that you can place on your map using latitude and longitude coordinates and use the positionChanged event to create/update custom external divs which contain your pie charts.

Google charts - Drill up

I was able to get drill down functionality using google charts api working. So basically in my view class, I have javascript which loads the google charts library and draws a pie chart.
On that pie chart selection handler, i do an Ajax call which generates a datatable and draw another chart for me.
I could not figure out how to implement a drill up using google charts. Basically I want to get the drill up functionality as same as HighCharts provide, I cannot use highcharts as it is licensed.
Can someone post some examples or ideas on how to get drill up working using google charts ?Basically i want a button to the top right corner of my level 2 pie chart and when i click that button it should take me to level 1 pie chart.
Thanks so much for your help!

Google Visualization API - Line and Scatter on one Chart

Does any one know if it is possible to use the Default Google Scatter Chart in the Google Visualizations Gallery to draw a scatter chart that has both a series with points only, a series with a line of best fit and on top of this a set of lines across the chart indicating limits. i.e. at +/- 20% etc.
The chart we need is actually a Control Chart with multiple series and individual formatting of each series displayed on the chart. i.e some series with only points other series with a line of best fit.
Does any one know of a Control Chart that has already been done using the Google Visualization API?
After working with the google visualization api for a while and searching the web I would have to say that the answer here is no.
You would have to build your own custom chart and from working with the api for a while I would rather do this with another charting library like jqPlot.
You can make separate line sets in the google scatterchart. The examples are on the scatterchart page.
http://code.google.com/apis/chart/docs/gallery/scatter_charts.html

Categories

Resources