Google Annotation chart: Could it be possible to reverse the Y-axis? - charts

I am working with the project that need Google Annotation Chart to show my data. And I have a problem like below.
My problem:
I would like to show the reverse value on the Y-axis.
What I mean is: the bigger the value is down and vice versa (the smaller the value is up)
I try to test all the option at the support docs but it still did not work
https://developers.google.com/chart/interactive/docs/gallery/annotationchart
Option:
...
vAxis: {direction: -1} // This works on line chart but not annotation chart
...
or somethings like
...
max: -200000, // this won't work and it's just keep the value not minus
min: 200000
...
This is my test code that forked from the docs page
https://jsfiddle.net/lecaoquochung/dsmgL9wj/2/
Could anyone help me to answer my problem? (Could it be possible to reverse the Y-axis now and later?)
Thank you very much

Problem solved. I have updated the testcode chart
Solution: add the chart to the option (get support from Googler)
chart : {vAxis: {direction: -1}},
Memo: Wonder that something updated in the API or just syntax (Because there is no description for chart option on graph docs pages)
Hope this help for anyone meet the same problem.

Related

Adding and removing Measures dynamically in sapui5 VizFrame

I would like to change Measures dynamically in my VizFrame like in ChartDemo App from sapui5 docs [link below].
https://sapui5.netweaver.ondemand.com/test-resources/sap/viz/demokit/chartdemo/index.html
So when I click to one of my five checkboxes the proper Measure will be added or removed in case of unchecking.
I have one json from which I get data.
I've tried with this code:
if(oCheckBox.getSelected()){
oVizFrame.removeFeed(feedValuesAxis);
feedValuesAxis.setValues("ValueFromJSON");
oVizFrame.addFeed(feedValuesAxis);
}
But it causes error:
[50005] - valueAxis : does not meet the minimum or maximum number of
feeds definition.
I am using SAP UI5 version 1.28.
I have one VizFrame, one Dataset with all Measures and two FeedItem one for values and one for Dimension.
I guess I have to create a binding, right? But how should I do it? Thanks a lot for any pieces of advice.
Simply, I have missed array when putting value into setValues() method.
So the answer is:
feedValuesAxis.setValues(["ValueFromJSON"]);

Chart js with problems when using too many series

I am using angular chart in one application which basically makes use of chart js. The version of chart js I am using at the moment is the 2.4.0, with angular chart version 1.1.1 (the current lastest one).
So, when I insert few series (for example 4) everything works fine. The problem is when I have cases that handle with 10 series at a time. The event of clicking the serie in order to hide it block somehow and this error is displayed in console:
Uncaught TypeError: Cannot read property 'clearRect' of null
at Object.helpers.clear (Chart.js:5880)
at Chart.Controller.clear (Chart.js:4072)
at Chart.Controller.draw (Chart.js:4365)
at ChartElement.animation.render (Chart.js:4345)
at Object.startDigest (Chart.js:3672)
at Chart.js:3645
To try to help you I moved to the line the error is occuring in Chart.js file:
// -- Canvas methods
helpers.clear = function(chart) {
chart.ctx.clearRect(0, 0, chart.width, chart.height);
};
Have anyone already got this problem? Does Chart js doesn't handle to many series?
Thanks
This was happening to me when I ran out of colors to use for my series. Once I fixed that the hiding and showing of series worked fine, plus no more errors.

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();

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.