google-visualization

Google charts secondary axis line charts

六眼飞鱼酱① 提交于 2019-12-23 13:15:31
问题 I'm currently learning a bit of google charts with web editting to broaden my knowledge and I'm having a issue I can't get around. <html> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Year', 'Derby', 'Bristol', 'Warrington', 'Indianapolis', 'Dahlewitz',

Want to show percentage data in legends of google pie chart

我只是一个虾纸丫 提交于 2019-12-23 12:26:36
问题 I am using google charts API specifically pie chart in my code i want to show percentage which is displayed inside chart to the legends also How can i display 29.2% sleep in legend? 回答1: You can do this two ways; either set the formatted values of the labels in the DataTable to include the percents, eg: // assume sleep is row 4, "sleepPercent" is the percent for sleep data.setFormattedValue(4, 0, data.getValue(4, 0) + ' (' + (sleepPercent * 100).toFixed(1) + '%)'); or you can set the legend

Object has no method getColumnType error

房东的猫 提交于 2019-12-23 12:19:48
问题 I have read the solution on this post but cannot seem to fit it to my issue. I am using google charts to build a line chart. x-axis being a date, y-axis being an integer. When I run my code I get a large error message Object {"it then lists all my JSON formatted data"} has no method 'getColumnType'. I am getting my JSON chart data from a web service via an AJAX call. My code so far <script type="text/javascript"> google.load("visualization", "1", { packages: ["corechart"] }); google

Convert Google Geochart to image (JPEG, PNG, etc.) or PDF in the browser

人盡茶涼 提交于 2019-12-23 09:17:56
问题 I'm using Google GeoCharts (https://developers.google.com/chart/interactive/docs/gallery/geochart#Overview) to dynamically generate color-coded maps in the browser. The geochart api draws the maps using javascript/svg... any advice for generating an exportable image file? (pdf, raster image, etc.) Can this be done through google geocharts? If not, is there another service you can recommend? *We were previously using GeoMaps but the resolution was not suitable. 回答1: This can be done by

Google Chart loads extremely small when included in jQuery-based tabs

谁都会走 提交于 2019-12-23 07:27:42
问题 I am using Google's line chart almost exactly as the demo - only the data has changed - inside of this jQuery tab plugin with no modification. Maybe 50% of the time, the chart will load at 400x200 even though it has been specified to load at 700x250. The containing div will have the proper width and height, but the chart as rendered by the API will load inside of that at 400x200. I suspect this is because the tabs aren't being displayed when the API tries to render. Because of that, it tries

Google Chart Number formatting

青春壹個敷衍的年華 提交于 2019-12-23 07:26:23
问题 I need to format my pie and column charts to show the $ and comma in currency format ($###,###) when you hover over the charts. Right now, it is displaying the number and percentage but the number as #####.## here is my code. Any help would be appreciated. // Load the Visualization API and the piechart package. google.load('visualization', '1.0', {'packages':['corechart']}); // Set a callback to run when the Google Visualization API is loaded. google.setOnLoadCallback(drawChart); var

How to change google chart title font size?

和自甴很熟 提交于 2019-12-23 06:56:23
问题 How do I change the font size of my title in google chart? var options = { title: 'My Daily Activities', 'backgroundColor': 'transparent', is3D: true, }; 回答1: Use titleTextStyle in options like this var options = { titleTextStyle: { color: <string>, // any HTML string color ('red', '#cc00cc') fontName: <string>, // i.e. 'Times New Roman' fontSize: <number>, // 12, 18 whatever you want (don't specify px) bold: <boolean>, // true or false italic: <boolean> // true of false } } You can find a

SQL query to Google's JSON format

柔情痞子 提交于 2019-12-23 06:22:56
问题 I have posted a code snippet a few days ago about this problem. I try to examine this problem from another side. So , I have a query and I would like to fill in a json file from its output. It contains more records, not only one. The problem is, that all the code, that I have found / I have wrote paste only the first record into the file with the cols. I think there is no existing tutorial about this problem. UPDATE: Sample output: Array ( [cols] => Array ( [0] => Array ( [id] => [label] =>

Get rid of color gradient for column headers in Google Visualization table

自闭症网瘾萝莉.ら 提交于 2019-12-23 05:23:29
问题 When I modify the column header colors using the event listener method shown here, I get a default gradient. The snippet example linked also is also showing the default gradient in the second column. How would I go about getting rid of the gradient when the color is generated by the event listener? 回答1: you could use background instead of backgroundColor . see following example... google.charts.load('current', { callback: function () { var data = new google.visualization.DataTable(); data

Google Visualization: Organizational Chart with fields named the same

試著忘記壹切 提交于 2019-12-23 05:11:46
问题 I am using Google Visualization: Organizational Chart LINK and structure is working very well, however I cannot named 2 or more fields with the same name in 1 row? I should be able to do that? Any ideas? 回答1: The OrgCharts require that each node have a unique ID, but you can change the formatted value of those nodes to be the same: var data = new google.visualization.DataTable(); data.addColumn('string', 'Name'); data.addColumn('string', 'Parent'); data.addRows([ [{v: 'parent_node', f: