on 2011 Jan 14 3:32 PM
I'm having some issues with the x-axis labels on an iChart.
The data I'm trying to display returns a date column I want to use as the x-axis labels. The data returned looks similar to the following:
MY_DATE | project1 | project2 | project3 .... Where the number of project columns returned can be variable, and the column names change as well based on the project name. The one column always returned in the data is the MY_DATE column.
The issue I'm having is that it doesn't display the custom labels for the x-axis. I specify "MY_DATE" as the "X-Axis Label Columns", yet it completely ignores it. I've verified in the javascript that the MY_DATE column is specified as the label column, but it doesn't use it.
I think I discovered what is making it not work, but I cannot figure out why. I have another identical display template, one has a static set of columns returned. I can then specify the "Value Columns" in the "Data Mapping" template category of the display template, as well as the label column "MY_DATE" under the X-axis label columns. In this case it works, but when I take the Data Mapping "Value Columns" away, the dates disappear from the x-axis.
Does anyone have another way to set custom labels for the x-axis? Or any insight as to why it wouldn't work?
Request clarification before answering.
Hi Austin,
What type of chart are you using? What type of query? What are the datatypes of the MY_DATE and Project columns?
Kind Regards,
Diana Hoppe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm using an Area chart, the query is a call to pl/sql. The data types are all varchar.
My work-around approach: I got this to work on the client side by specifying the value columns to be the names of the projects being returned. For example, if the result columns are DATE, ProjA, ProjB I then have to (through javascript) tell the chart object the value columns are "ProjA,ProjB". This requires another database call, however.
In addition, my same work-around doesn't work in a transaction when trying to add the chart to a PDF file.
There has to be another way to do this!
Some more findings:
My charts have a legend on the right side. If I change the display template to use "Legend On Top", the labels are displayed correctly. If I change the legend to be on the right, the labels do not show up.
I found that this happens only the FIRST time the chart is loaded and rendered. If I reload the chart or right click -> refresh, the date labels are displayed properly...
Why would the legend be causing this?
Austin,
What do you want the user to see initially? An empty chart? Please explain the initial state of the chart and how the user interacts with it.
1. Is your query time-sensitive? This means in the SQL Query you have designated a Date Column or used the SD and ED tokens in a filter expression. If the query is time-sensitive, the date will automatically map as the X-Axis label. If it is not time-sensitive, in addition to adding the My_Date to the X-Axis Label Colunms, add it to the X-Axis Value Columns.
2. I have found that if I return all the columns in the query, then I simply have to do this to make them show upon some event triggered by the user:
// assume user chose these columns
var valCols = "ProjA,ProjB,ProjC";
var chartObj = document.AreaChart.getChartObject();
chartObj.setValueColumns(valCols);
document.AreaChart.updateChart(true);
3. I wrote a small transaction using the same query and display template in the Chart action block configuration. I created a transaction property for inputting the value columns (a comma-separate list) and linked this transaction property (the source property) to the Chart action's ValueColumns property (the desination property). I then use a PDF Document action and a PDF Image action, linking the encodedImage property of the Chart to the encodedImage. When I varied the content of the transaction input property to use differenct columns, the changes showed in the PDF Document.
Hope this is helpful.
Kind Regards,
Diana Hoppe
Hi Diane,
I'm using MII V. 12.1.6.96. My JRE is 1.6.0_20.
At first, I want the chart to be hidden (via hiding the html element). The user clicks a "Search" button and I tell the chart to update after setting my parameters. After it's updated, I display the html element. The SQL query takes 7 parameters.
In response to your comments:
1) I don't use any built in date functionality in the query template. If I add it to the label columns none of my data is displayed. Note that if I change the legend to be on top the x-axis is displayed properly. That's all that I change in the template.
2) Yes, your code block is exactly what I'm doing. Here is my section:
document.ProjectsChart.getChartObject().setValueColumns(this.getTopProjectNames(headcountSearchModel).toString());
document.ProjectsChart.getChartObject().setXAxisMajorTickCount(headcountSearchModel.numberOfMonths-1);
document.ProjectsChart.getChartObject().setXAxisShowTicks(true);
document.ProjectsChart.updateChart(true);3) I'm doing exactly what you're describing. If I set the links to use my comma separated list for ValueColumns with the legend set to display on top, it works perfectly. If I change it back to my desired legend on the right, it doesn't work.
Thanks for your help.
Edited by: Austin Kindred on Feb 11, 2011 5:06 PM
Hi Austin,
It is difficult to assist you without seeing all the pieces. You may consider entering a ticket into the SAP Support System so somone can take a look and make suggestions. If you haven't alreay, take a look at the MII Best Practices Guide:
[http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/f08d7ae2-6f56-2c10-50b4-8a3bb1d43502]
You may also consider upgrading to the latest 12.1 Service Pack, which I believe is SP08
Kind Regards,
Diana Hoppe
HI,
Are you doing a chart refresh/update in your Java Script?
Did you ensure that data is being returned in case of the dynamic query (right click on the chart applet and data/show data)?
Which version of MII are you on?
Thanks
Udayan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.