ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  coordinate show
Posted by Jee on Feb-14-2011 20:03
Hi,
  Is there any way to show the XY-Coordinates of a particular point in a line graph and in
a bar graph[Java version] while focus using mouse pointer?

with regards
  Jee

  Re: coordinate show
Posted by Peter Kwan on Feb-15-2011 10:18
Hi Jee,

Would you mind to clarify what is "particular point" referring to?

Do you mean you want to show the (x, y) coordinates of a data point used to plot the line chart when the mouse is over the data point, and to show the (x, y) coordinates of a bar when the mouse is over a bar in a bar chart?

I think in almost all ChartDirector for JSP/Java sample code, we have included popup tooltips to show the similar information when the mouse is over the data representation (line segments in line chart, bar segments in bar chart, slices in pie chart, etc). Is this what you need?

Do do you mean you want to show the (x, y) coordinates under the mouse cursor, irrespective of where it is on the chart (even if it is just point to an empty position in the plot area)? To do this, you jeed need to handle the standard mouse move event to obtain the mouse coordinates. If you would like to translate the mouse coordinates to data coordinate, you may refer to the following thread for some information:

http://www.chartdir.com/forum/download_thread.php?bn=chartdir_support&thread=1187910016#N1187953452

Hope this can help.

Regards
Peter Kwan

  Re: coordinate show
Posted by Jee on Feb-15-2011 12:53
Hi

What i meant is, show the (x, y) coordinates of a data point used to plot the line chart
when the mouse is over the data point, and to show the (x, y) coordinates of a bar
when the mouse is over a bar in a bar chart for java version. And i gone through the
documents but could find the explanation only for jsp version with an HTMLImageMap, i
want to do it in java.

with regards
   Jee

  Re: coordinate show
Posted by Peter Kwan on Feb-16-2011 09:00
Hi Jee,

By "Java", I assume you mean you are using Java to write a desktop GUI application. (Java can be used in JSP, in desktop application with varous GUI toolkits such as SWING, in command line applications, etc.)

There should be a lot of example Java desktop GUI application included in ChartDirector. For example, if you look at the "Simple Bar Chart" sample code in the ChartDirector documentation (you may look for "Simple Bar Chart" in the ChartDirector documentation index), you can see it lists out two versions of the code - one is for Java/JSP, and one is for Java/SWING (a desktop GUI example).

The getHTMLImageMap works on Java SWING GUI desktop applications too. The followings are the code from the "Simple Bar Chart" sample code (desktop GUI version):

        // Output the chart
        viewer.setImage(c.makeImage());

        //include tool tip for the chart
        viewer.setImageMap(c.getHTMLImageMap("clickable", "",
            "title='{xLabel}: US${value}K'"));

If you try the sample code (see the Installation section of the ChartDirector documentation on how to compile and run the sample code), you should see a window with a bar chart. When the mouse is over the bar, there will be pop up tooltips showing the x and y values of the bar.

Hope this can help.

Regards
Peter Kwan

  Re: coordinate show
Posted by Jee on Feb-16-2011 18:02
Hi,

   Done with that.. Thanks for your great helt.

Regards
   Jee