Jetender Posted April 12, 2007 Report Share Posted April 12, 2007 Hi , i have 4 charts to be displayed in One page , and am achieving this using an ajax call which generates the charts using the same page...To distinguush between the charts i am trying to set the ID as shown in the code that follows. However , the Image Map name for Each of the 4 charts is still "Chart1" . All charts have URLs on the points being plotted , but when rendered , the Map being used has the name "Chart1" and so all the 4 charts display hrefs at the position of the point on the first chart. Am i issing something here?? Do i need to have different object identifiers for the 4 different charts? ChartServer chart1 = new ChartServer(application,request,response); if(chartNumber==0){ chart1.setID("chart1"); }else if(chartNumber==1){ chart1.setID("chart2"); }else if(chartNumber==2){ chart1.setID("chart3"); }else if(chartNumber==3){ chart1.setID("chart4"); } chart1.getXValue().setItem(0, i,((MyObject) MyObjectListget(i)).getXValue( ) ); chart1.getValue().setItem(0, i,((MyObject) MyObjectListget(i)).getYValue( )); chart1.getPoint().getItem(0, i).setURL("javascript:sh..."); chart1.setImgMap(ImgMap.EMBEDDED); <%=chart1.getHtmlTag("367","241","Jpeg") %> Link to comment Share on other sites More sharing options...
GabrielA Posted April 12, 2007 Report Share Posted April 12, 2007 To fix this, you have to set the ID of each chart: chart1.setID("Chart1");chart1.setID("Chart2");etc. These IDs will be used as names for the image maps. Link to comment Share on other sites More sharing options...
Jetender Posted April 12, 2007 Author Report Share Posted April 12, 2007 Turns out , getHtmlTag() seems to be resetting the ID to Chart1...still dont know why and what to do about it. Link to comment Share on other sites More sharing options...
Jetender Posted April 12, 2007 Author Report Share Posted April 12, 2007 Thanks for the prompt reply GabrielA, There is only one Chart object as the page itself id loaded 4 times, and is displayed in 4 divs populated on AJAX calls, I have used setID based on the chartNo , please note this in the code, also as mentioned in a reply posted by me , on printing the values of the ID before and after the <%=chart1.getHtmlTag("367","241","Jpeg") %> , there is a difference in the IDs, after the call , the ID seems to be getting RESET to "Chart1". Link to comment Share on other sites More sharing options...
Jetender Posted April 12, 2007 Author Report Share Posted April 12, 2007 YIPPEE....SOLVED... I guess i was on the right track and so the obvious was to try this...ie...use a different getHtmlTag which takes the chart ID .... But the behaviour of the intially used method seems to have a hard-coded set call to change the name .i smell a BUG! <% if(chartNumber==0){ %> <%=chart1.getHtmlTag("367","241","Jpeg","chart1") %><% }else if(chartNumber==1){ %> <%=chart1.getHtmlTag("367","241","Jpeg","chart2") %><% }else if(chartNumber==2){ %> <%=chart1.getHtmlTag("367","241","Jpeg","chart3") %> <% }else if(chartNumber==3){ %> <%=chart1.getHtmlTag("367","241","Jpeg","chart4") %> <% }%> Link to comment Share on other sites More sharing options...
GabrielA Posted April 12, 2007 Report Share Posted April 12, 2007 I completely misread your code, I'm sorry. The way your solved is the other possible alternative, but your original code should work as well. I'll test it to see what I can find. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.