Ok thanks. I'll try for it and find the way. On Tuesday, 23 October 2012 11:25:04 UTC+5:30, asgallant wrote: > > I've looked into this before, and to the best of my knowledge (and search > skills), there just isn't any way to do it in javascript. I've heard of > other people setting something up where they send the image data back to > the server, have the server save it as a file with a .png extension, and > redirect the browser to the new image url, which triggers the download and > (depending on the browser and settings) may prompt the user to select the > download location. You'll have to google it if you want to take that > route, though, as I don't know exactly how it's done. > > On Tuesday, October 23, 2012 1:26:55 AM UTC-4, taps wrote: >> >> How can I rename it by myself.? Pls. give me some idea. Its urgent.. >> >> On Tuesday, 23 October 2012 10:40:00 UTC+5:30, taps wrote: >>> >>> I cant alert user for that for renaming it. I have to do it by myself >>> only. Cant we open a save dialog to save the image that will provide user >>> flexibility. >>> >>> On Tuesday, 23 October 2012 10:35:10 UTC+5:30, asgallant wrote: >>>> >>>> In traditional javascript, you have no control over that. It's >>>> possible HTML5 changes things, but I don't think so in this case. Being >>>> able to direct the name and location of a download programatically could >>>> be >>>> a security issue. Your best be might be to alert your users that they >>>> have >>>> to change the file name in order to view it. >>>> >>>> On Tuesday, October 23, 2012 12:44:14 AM UTC-4, taps wrote: >>>>> >>>>> but I cant force the user to change that. So, is there a way to save >>>>> it in that format and if users want to save the image in other folder can >>>>> we do that and how? Because now it is being saved in downloads. I want to >>>>> save it in other folder. >>>>> >>>>> On Monday, 22 October 2012 20:10:26 UTC+5:30, asgallant wrote: >>>>>> >>>>>> With some browsers, you have to rename them as .png files after >>>>>> downloading them. >>>>>> >>>>>> On Monday, October 22, 2012 2:45:57 AM UTC-4, taps wrote: >>>>>>> >>>>>>> Thanks, Its working. But The saved images cant be opened. >>>>>>> >>>>>>> On Friday, 19 October 2012 11:02:08 UTC+5:30, asgallant wrote: >>>>>>>> >>>>>>>> Ahh...I see now. You are missing two of the scripts you need: >>>>>>>> >>>>>>>> http://canvg.googlecode.com/svn/trunk/canvg.js >>>>>>>> http://canvg.googlecode.com/svn/trunk/rgbcolor.js >>>>>>>> >>>>>>>> You need script tags with both of those to make it work. >>>>>>>> >>>>>>>> On Thursday, October 18, 2012 2:00:19 AM UTC-4, taps wrote: >>>>>>>>> >>>>>>>>> Hey, I have tried that code but it doesn't work. It doesn't do >>>>>>>>> anything.I don't what is wrong.my code is: >>>>>>>>> >>>>>>>>> <apex:page > >>>>>>>>> <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([ >>>>>>>>> ['ID', 'X', 'Y', 'Temperature'], >>>>>>>>> ['', 80, 167, 120], >>>>>>>>> ['', 79, 136, 130], >>>>>>>>> ['', 78, 184, 50], >>>>>>>>> ['', 72, 278, 230], >>>>>>>>> ['', 81, 200, 210], >>>>>>>>> ['', 72, 170, 100], >>>>>>>>> ['', 68, 477, 80] >>>>>>>>> ]); >>>>>>>>> >>>>>>>>> var options = { >>>>>>>>> colorAxis: {colors: ['yellow', 'red']} >>>>>>>>> }; >>>>>>>>> >>>>>>>>> var chart = new >>>>>>>>> google.visualization.BubbleChart(document.getElementById('chart_div')); >>>>>>>>> chart.draw(data, options); >>>>>>>>> } >>>>>>>>> </script> >>>>>>>>> <div id="chart_div" style="width: 900px; height: 500px;"></div> >>>>>>>>> <button >>>>>>>>> onclick="saveAsImg(document.getElementById('chart_div'));">Save as >>>>>>>>> PNG >>>>>>>>> Image</button> >>>>>>>>> <script> >>>>>>>>> function getImgData(chartContainer) { >>>>>>>>> alert("hiiiii"); >>>>>>>>> var chartArea = >>>>>>>>> chartContainer.getElementsByTagName('svg')[0].parentNode; >>>>>>>>> var svg = chartArea.innerHTML; >>>>>>>>> var doc = chartContainer.ownerDocument; >>>>>>>>> var canvas = doc.createElement('canvas'); >>>>>>>>> canvas.setAttribute('width', chartArea.offsetWidth); >>>>>>>>> canvas.setAttribute('height', chartArea.offsetHeight); >>>>>>>>> >>>>>>>>> >>>>>>>>> canvas.setAttribute( >>>>>>>>> 'style', >>>>>>>>> 'position: absolute; ' + >>>>>>>>> 'top: ' + (-chartArea.offsetHeight * 2) + 'px;' + >>>>>>>>> 'left: ' + (-chartArea.offsetWidth * 2) + 'px;'); >>>>>>>>> doc.body.appendChild(canvas); >>>>>>>>> canvg(canvas, svg);alert("hiiiiffffi"); >>>>>>>>> var imgData = canvas.toDataURL('image/png'); >>>>>>>>> canvas.parentNode.removeChild(canvas); >>>>>>>>> >>>>>>>>> return imgData; >>>>>>>>> } >>>>>>>>> >>>>>>>>> function saveAsImg(chartContainer) { >>>>>>>>> alert("hiiiii"); >>>>>>>>> var imgData = getImgData(chartContainer); >>>>>>>>> >>>>>>>>> // Replacing the mime-type will force the browser to >>>>>>>>> trigger a download >>>>>>>>> // rather than displaying the image in the browser window. >>>>>>>>> window.location = imgData.replace('image/png', >>>>>>>>> 'image/octet-stream'); >>>>>>>>> } >>>>>>>>> </script> >>>>>>>>> </apex:page> >>>>>>>>> >>>>>>>>> On Wednesday, 17 October 2012 20:16:36 UTC+5:30, asgallant wrote: >>>>>>>>>> >>>>>>>>>> See this thread: >>>>>>>>>> https://groups.google.com/forum/?fromgroups=#!topic/google-visualization-api/YTD_JxX_RFc >>>>>>>>>> >>>>>>>>>> Note that the code linked there will never work in IE < 9, as >>>>>>>>>> those use VML to draw the charts instead of SVG, and there is no way >>>>>>>>>> (that >>>>>>>>>> I know of) to convert VML into an image file. >>>>>>>>>> >>>>>>>>>> On Wednesday, October 17, 2012 3:14:46 AM UTC-4, taps wrote: >>>>>>>>>>> >>>>>>>>>>> Hello, I have created a bubble chart based on the user >>>>>>>>>>> selection.I need to save the chart in the form of image or any >>>>>>>>>>> other >>>>>>>>>>> way.How can save it? >>>>>>>>>>> >>>>>>>>>>
-- 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/-/Q0cQJ3X-5fkJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
