How can I specify the target page???

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Kamelo
Posts: 6
Joined: Fri Dec 01, 2006 9:47 am

How can I specify the target page???

Post by Kamelo » Thu Dec 07, 2006 12:08 pm

Hi there,
Does anyone know to specify the target page when generating a URL in bar chart?

I am creating a bar chart with three bars, and I want to know how can I set a different url for each bar and how can set the target page i.e like in html where we set target="_blank" in order to open the url page in a new window?

Your help is very appreciated.

Thanks in advance.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Dec 07, 2006 2:43 pm

You'll have to provide a custom implementation of the CategoryURLGenerator interface.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

ahill
Posts: 7
Joined: Mon Nov 20, 2006 11:22 pm
Location: Singapore

Post by ahill » Fri Dec 08, 2006 2:48 am

Surely CategoryURLGenerator only generates the URL itself?

The target is a seperate html attribute in the area tag. Looking at the code in ChartEntity it uses an implementation of the URLTagFragmentGenerator in getImageMapAreaTag() to generate the full html for the tags in the html area map.

The default impl as used by ImageMapUtilities is StandardURLTagFragmentGenerator which just has

Code: Select all

public String generateURLFragment(String urlText) {
            return " href=\"" + urlText + "\"";
        }
You could instead provide your own impl that has

Code: Select all

public String generateURLFragment(String urlText) {
            return " href=\"" + urlText + "\" target=\"_blank\"";
        }
As you also need to implement CategoryURLGenerator to customise the URL contents like David mentioned you could have your class implement both interfaces.

hth

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Dec 08, 2006 11:10 am

You are absolutely right...sorry for the misinformation.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Kamelo
Posts: 6
Joined: Fri Dec 01, 2006 9:47 am

How can I specify the target page???

Post by Kamelo » Mon Dec 11, 2006 10:40 am

Thanks Guys,

I will try that.

Regards


Kamel A.

Locked