cancel
Showing results for 
Search instead for 
Did you mean: 

How to make i5Chart clickable

Former Member
0 Kudos

How to make i5Chart clickable and opens up in a pop-up window?

Here is one chart code:

var i5Chart1 = new com.sap.xmii.chart.hchart.i5Chart("WVLMicrofiber7/Charts/WVLCharts", "WVLMicrofiber7/WebServices/WSWVL7TESTDATA");

                i5Chart1.setChartWidth("540px");

                i5Chart1.setChartHeight("250px");

                var Query1= i5Chart1.getQueryObject();

                Query1.setParameter("Param.1",Machine);  

                Query1.setParameter("Param.2","FREENES1");      

                i5Chart1.draw("1");

Accepted Solutions (1)

Accepted Solutions (1)

Private_Member_14935
Active Participant
0 Kudos

Hi Amr,

To make an element clickable you can use the below snippet (with jQuery):

$("#chart1").click(function() { window.open('http://www.google.com', '_blank'); });

where chart1 is the div id provided in i5Chart1.draw("chart1")

Best Regards,

Ria






former_member215598
Participant
0 Kudos

Hello Ria,

Do I write the above snippet in a java script?  Like:

<script>

$("#chart1").click(function() { window.open('http://www.google.com', '_blank'); });

</script>

Private_Member_14935
Active Participant
0 Kudos

Hi Amr,

You will have to place this code in the onload event of the page or a place where you are sure that the element already exists in the DOM.

For e.g,

function load() {

$("#div").click(function() {

  alert("You clicked the i5Chart");

  //window.open('http://www.google.com', '_blank');

});

}

<BODY onload='load();'>

<div id="div"/>

</BODY>

Hope this helps!

Best Regards,

Ria

Former Member
0 Kudos

In this example, we are not using JQuery - we like to pass the parameter in the URL - do you know how?

Param.1",Machine;              

Param.2","FREENES1";
Private_Member_14935
Active Participant
0 Kudos

Hi Amr,

Internally in our js library we refer jQuery library hence you should be able to use it.

I'm not clear about your requirement about passing parameter in URL... can you please explain the scenario/requirement.

Best Regards,

Ria

Former Member
0 Kudos

Actually, it seems it can only work only for MII query - where you want to pass parameters to the URL to view the content.

I do not think it applies to the charts.......

The following did not work:

function load() {

$("#div1").click(function() {

  alert("You clicked the i5Chart");

  //window.open('http://www.google.com', '_blank');

});

}

<BODY onload='load();'>

<div id="1"/>

</BODY>

Private_Member_14935
Active Participant
0 Kudos

Hi Amr,

That code didn't work because the div id that you have used in load() is incorrect. Within div tag you have used "1" as the id and in load() you have used "div1". You can modify the div tag as shown below and it should work for you:

<div id="div1"/>


Further, I didn't get what you mean by "do not think it applies to the charts".



Best Regards,

Ria

Answers (0)