0

IE7: Imagemap Tooltip Not displaying

asked 2011-07-28 11:05:06 +0800

wgoodrich gravatar image wgoodrich
9

We are replicating the code seen at:
http://docs.zkoss.org/wiki/Integrating_JFreeChart_to_ZK_Framework%2C_Part_II
and are able to get tooltip to display for all browsers except for IE7. Has anyone else run into similar problems? We are using ZK version 5.0.7.

thank you

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2011-07-28 22:59:27 +0800

matthewgo gravatar image matthewgo
375

Hi~
I followed the same smalltalk and it works well in IE7 (also works well in an IE9 with IE7 compatibility mode)
Here is the online-vedio: http://screencast.com/t/ji5TM00JHrB
Here is my code:

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="new page title" border="normal">
<imagemap id="myimage">
  <attribute name="onClick"><![CDATA[
    if (event.getArea() != null) {
      alert(self.getFellow(event.getArea()).getTooltiptext());
    }
  ]]></attribute><zscript>
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot3D;
import org.jfree.chart.ChartFactory;
import java.awt.image.BufferedImage;
import org.jfree.chart.encoders.ImageFormat;
import org.jfree.chart.encoders.EncoderUtil;
import org.zkoss.image.AImage;
import org.jfree.chart.entity.PieSectionEntity;
import org.jfree.chart.entity.ChartEntity;
import org.jfree.chart.ChartRenderingInfo;


DefaultPieDataset pieDataset = new DefaultPieDataset();
pieDataset.setValue("C/C++", new Double(17.5));
pieDataset.setValue("PHP", new Double(32.5));
pieDataset.setValue("Java", new Double(43.2));
pieDataset.setValue("Visual Basic", new Double(10));

JFreeChart chart = ChartFactory.createPieChart3D("Sample Pie Chart 3D", pieDataset,true,true,true);
PiePlot3D plot = (PiePlot3D) chart.getPlot();
plot.setForegroundAlpha(0.5f);
ChartRenderingInfo info = new ChartRenderingInfo();
BufferedImage bi = chart.createBufferedImage(500, 300, BufferedImage.TRANSLUCENT, info);
for(Iterator it=info.getEntityCollection().getEntities().iterator();it.hasNext();) {
  ChartEntity ce = ( ChartEntity ) it.next();
  if (ce instanceof PieSectionEntity) {
    Area area = new Area();
    area.setParent(myimage);
    area.setCoords(ce.getShapeCoords());
    area.setShape(ce.getShapeType());
    area.setId(myimage.getId()+'_'+((PieSectionEntity)ce).getSectionIndex());
    area.setTooltiptext(ce.getSectionKey().toString());
  }
}
byte[] bytes = EncoderUtil.encode(bi, ImageFormat.PNG, true);
 
AImage image = new AImage("Pie Chart", bytes);
myimage.setContent(image);
</zscript></imagemap>
</window>
</zk>

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-07-28 11:05:06 +0800

Seen: 209 times

Last updated: Jul 28 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More