PNG area chart with Google Charts API? - perl

I want to make an area chart with Google's Chart API, but it needs to be the PNG format one so I can build a PDF. Is that possible? The Chart Wizard does not seem to support area charts. Also, I want to do it in perl and the URI::GoogleChart module.

I spent a lot of time on this and discovered that I can do this:
See the example visually or the code below:
http://chart.apis.google.com/chart
?chxl=1:|week1|week2
&chxp=1,20,90
&chxr=0,0,120
&chxs=0,676767,11.5,0.5,l,676767|1,676767,9.5,0,_,676767
&chxt=y,x
&chs=300x278
&cht=lxy
&chco=FF9900,FF0000
&chds=6.667,100,0,110,0,100,0,118.333
&chd=t:-1|110,80|-1|43,32
&chdl=Total+Num|Special+Num
&chdlp=t
&chg=1,-1,1,0
&chls=2|2
&chma=8,0,0,7|54,2
&chtt=%23+Total+and+%23+Red+Items
&chts=000000,11.5
&chm=b,FF9900,0,1,0|B,FF0000,1,9,0
Where the last line b,color,startLine,endLine,0 means fill down to endLine and B,color,startLine,arbitraryNumber,0 means fill down to the bottom of the chart.
The solution came from Google's docs with some experimentation.

Related

Android studio anychart circular gauge

Can I set new data to AnyChartView??
when I use AnyChartView.setData(circularGauge); it creates itself below of my first chart.
this my setChart code.
any_chart.setChart(circularGauge);
and one I need a full documentation for anychart circular gauge.
thank you all for answer.
There's no need to recreate or reapply the chart to update the data. All you need is to make chart active and apply new data to the existing chart. Here is the required code to apply new value 50:
APIlib.getInstance().setActiveAnyChartView(circularGauge);
circularGauge.data(new SingleValueDataSet(new Integer[] {50}));
Here is the Circular Gauges documentation. It's for the web version of the library, but the API is absolutely the same.

Stepped Stacked chart not seen as EmbeddedChart in Google sheets API?

I am working with a spreadsheet that contains multiple sheets. In every sheet there is 1 chart.
I am using Google Apps Script to get these specific charts, which is working perfectly for all types of charts, except for the 'Stepped Stacked Chart', not to confuse with the 'Stepped Chart'.
Example code to explain the issue:
function getCharts(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var steppedStackedSheet = ss.getSheetByName('chart_2');
var otherChart = ss.getSheetByName('chart_1');
Logger.log(steppedStackedSheet.getCharts()); // returns an empty array
Logger.log(otherChart.getCharts()); // returns an array [EmbeddedChart] - This is what i also expect to see in the steppedStackedSheet chart.
}
I am buidling a script that downloads the chart as an image, but it's strange that this specific chart is not being recognized as a chart.
Haven't found anything on Google but hopefully someone here has had a similar issue and/or a solution.
Here an example sheet, also including the script
Thanks in advance!
As described in this documentation,
For 100% stacking, the stacks of elements at each domain-value are rescaled such that they add up to 100%. The options for this are isStacked: 'percent', which formats each value as a percentage of 100%, and isStacked: 'relative', which formats each value as a fraction of 1. There is also an isStacked: 'absolute' option, which is functionally equivalent to isStacked: true.
You may use setStacked() which uses stacked lines, meaning that line and bar values are stacked (accumulated). By default, there is no stacking. The return type is EmbeddedColumnChartBuilder.

ZK Charts, clearing the chart

I am using ZK charts in my project. I am having line type charts. And using addSeries on my chats. But when I want refresh charts as in when user if fetching new Data, I am not sure how to clear the graph. Please help.
For example, if you are using series to add points on the chart (in my example I am using Float values) you can empty data displayed by setting an empty list to the series, like this:
chart.getSeries().setData(new ArrayList<Float>());
this one worked for me,
just write this line before populating your chart
chart.getSeries().setData(0);
To do that just call the method
chart.invalidate();

PowerPoint Interop - How to access Chart out of a shape?

I am working in an office automation tool to process PowerPoint documents, where I am facing an issue in formatting Chart.
I am using the following assemblies for formatting the Presentation
Microsoft.Office.Interop.PowerPoint Version: 12.0.0.0
Microsoft.Office.Interop.Graph Version: 12.0.0.0
Requirement is to apply some styles like Legend location, color, font etc to the Chart exists in the presentation.
I am able to verify the Shape like
shape.HasChart == MsoTriState.msoTrue
But not able to get the Chart object out of the shape
Tried the following code, but received OLEFormat exception
Graph.Chart chart = (Graph.Chart)shape.OLEFormat.Object
Thanks in advance for your help.
Resolved the issue by selecting correct reference from the COM tab.
Answer from thread - http://social.msdn.microsoft.com/Forums/en-US/officegeneral/thread/06cea2b7-f169-4f8a-b53e-4319b12b5450
I know you are asking from (rather) .NET point of view but I'll show you some code from VBA PowerPoint. My goal is to show you object hierarchy. I believe it would be helpful enough for you to solve your problem.
Sub Chart_Elements()
Dim CHRT As Chart
'first shape in the 1st slide is chart
Set CHRT = ActivePresentation.Slides(1).Shapes(1).Chart
With CHRT
'to set legend position
.Legend.Position = xlLegendPositionBottom
'to set size of 1st entry in legend
.Legend.LegendEntries(1).Font.Size = 10
'and so on
End With
End Sub
If that answer doesn't help you at all please consider re-tagging your question.

Formatting a line chart

I have a line chart in a report (rdlc), that I cannot get formatted correctly. There are 2 main things I am trying to accomplish.
1) The x-axis is a date, right now it is being displayed as the full date with time, and I want it to be displayed as mm/dd/yyyy. I have attempted to change this by using =FormateDateTime(Fields!EndDate.Value, DateFormat.ShortDate) This is exactly how I saw it in Microsoft's examples, even the one included in VS2008 (what I am using), but for some reason it says that .ShortDate is and unrecognized identifier. I am thinking this might be a bug. So any ideas on how to get it into the mm/dd/yyyy format?
2) I want the values that are being plotted not to be there actual value but the previous values before added to the value. This is to accomplish a continual upward slope, showing the totals. I would also like to filter out zero's since the first 20 entries are so are 0. When I try to use the filter option it for some reason makes the chart just a flat line.
Any suggestions to any of these problems or a link to a good tutorial would be great as I am new to using these reports. Thanks!
Update: I have accomplished these by applying changes to the actual data being supplied, I would still like to know an easier better way to do this.
You can format the date in the lable under the general tab like this.
=Format(Fields!POWDate.Value, "M/dd/yyyy")
As of now I have fixed the problem by formating the data in the SQL query to the way I would like it to be displayed in the report.