cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Color Context and Data Series in Bar Graph MII 12.2

Former Member
0 Kudos

Hi All

My Xacute query is returning data in the following format :

I need to color the bar "Grand Total" in a different color from the "Planned Quantity".I would have been able to do it if "Grand Total" was a different Column all together but now i can only differentiate the data from the fact that for the entries other than "Grand Total" there is a date in the "Date" Column but the "Date" Column  has value as "Grand Total"(which i have intentionally set,as this has to be displayed as Grand Total on the final graph)

I tried using the Color Context with Mode as String,Match type as String and value as "Grand Total" but that did not change anything I have this graph :

but i need to show it like this :

I have also tried using the following  in the java script under my corresponding applet :

  <PARAM NAME="MatchMode" VALUE="String">

                                        <PARAM NAME="MatchColumns" VALUE="Date">

                                        <PARAM NAME="MatchValues" VALUE="Grand Total">

                                         <PARAM NAME="MatchColors" VALUE="#00ff00">

but this too did not bring any change

Can any one give any pointers please ?

Regards

Shweta

Accepted Solutions (0)

Answers (1)

Answers (1)

jcgood25
Active Contributor
0 Kudos

Did you try using Date as the 'LabelColumns' in your mapping?  This should create two sets of data series (two items in legend) which you should then be able to assign colors accordingly.

Former Member
0 Kudos

Thanks Jeremy for your response

However If you look closely at the first graph i attached,I am already using Date column as the Label Column on the X axis.My issue here is to represent the bar corresponding to Grand Total in a different color other than the rest of the bars.

Regards

Shweta

former_member204240
Active Participant
0 Kudos

Try passing value in Color Context

Color Context with Mode as String,Match type as String and value as 25270 and select required color. This works I tried.

You can pass this value dynamically by keeping some variable in Applet.

var grandtotal="get value from your xacute to this var"

<PARAM NAME="MatchMode" VALUE="String">

<PARAM NAME="MatchValues" VALUE="+grandtotal+">

<PARAM NAME="MatchColors" VALUE="#00ff00">

Former Member
0 Kudos

Hi Padma

My Xacute query  has 2 columns Date and Quantity.How can i get the value of the column Quantity in my java script.I tried the function getOutputParameter but did not return the expected results.I could not figure out the exact method to get the value of a column.

Please help.

Regards

Shweta

former_member204240
Active Participant
0 Kudos

Use iCommand

ICommand runs the query and applets are hidden on screen display. You can execute the query under icommand and get data results.

<applet archive="illum8.zip" code="iCommand" codebase="/XMII/Classes" height="1" mayscript="" name="SampleApp" width="1">

  <param name="QueryTemplate" value="projFolder/Folder/XacuteQry">

</applet>

Pass the correct path of your xacute query.

The above section as you know will be under html.

So now inside your script tag, or under the function where you need this, use applet method

SampleApp.getQueryObject().setParam(1,yourparameters);

SampleApp.executeCommand();

var grandtotal=SampleApp.getValue(2,4);

I  hope you are familiar with set param and all if you have done for grid,ibrowser etc.

so same way use executeCommand() function which runs the query in the icommand applet. So last line is to get the grand total value according to your output, I am passing (2,4) which points to 2nd column and 4th row of your output.

Former Member
0 Kudos

I have figured out a way through which i can find the value of this column something like this

document.currentWeek.getChartObject().getYDataValueAt(1, 7)

where 7 is the row count but i am not finding any way to find the total number of rows returned from an xacute query.

Also as you suggested if i use iCommand how can i display the same in a chart :

is this corrrect assumtion :

<APPLET NAME="currentWeek" CODEBASE="/XMII/Classes" CODE="iCommand" ARCHIVE="illum8.zip" WIDTH="640" HEIGHT="400" MAYSCRIPT>

                                                            <PARAM NAME="QueryTemplate" VALUE="Path of query">

                                                  <PARAM NAME="DisplayTemplate" VALUE="Path of iChart">

                                                    <PARAM NAME="Content-Type" VALUE="image/png">

                                                            </APPLET>

Former Member
0 Kudos

My bad ...i got your point,Let me try this and get back

Former Member
0 Kudos

Hi Padma

i could get the value of the grand total correctly and pasted the applet code as you suggested but still nothing changed in the graph.

I am getting the value of grandtotal on body onload function ,do you think that could be an issue because as soon as the body loads the applet is also getting displayed even before the value of grand total could be passed to it ??

Regards

Shweta

Former Member
0 Kudos

Now i am getting the value of grandtotal in a function which is getting called on the selection event of the template but still nothing changed.

My columns Date :String,Planned Quantity:    Double

When i hard code the desired value of planned quantity in color context of my Chart it does change the color of the bar with this value.

When i try passing this value to my applet in a variable and tries to  match the value,it doesnt work,I am assuming it is because the Xacute query in between chops off the trailing decimals and shows the value as 56948 and not 56948.0.

The Context color functionality in my graph is only giving desired result when i choose match type as "Double" and value as 56948.0.

Any pointers ??

former_member204240
Active Participant
0 Kudos

Did it worked fine without decimal when you tried passing some whole numbers from the screen?

Instead of match mode string use double and try.
Also I hope your xacute column is also double?

I haven't tried it, lemme try this for you.

former_member204240
Active Participant
0 Kudos

Shwetha, I tried it works.

I created applet dynamically. And your variable should have value like below

grandtotal="Double:125.345;";