|
clickable pie chart |
Posted by TL on Dec-24-2010 00:01 |
|
Hi, can someone please tell me how to set each slice of the pie with different URL?
I tried the code below, but its not working:
String chartImageMap = pcChart.getHTMLImageMap("../BlaBla/Bla.aspx"); //the path of current page
String sectorImageMap = "<area " + pcChart.getSector(0).getImageCoor()
+ "href=../BlaBla/something else1";
String sector1ImageMap = "<area " + pcChart.getSector(1).getImageCoor()
+ "href=../BlaBla/something else2";
String sector2ImageMap = "<area " + pcChart.getSector(2).getImageCoor()
+ "href=../BlaBla/something else3";
wcvWebChartViewer.ImageMap = chartImageMap + sectorImageMap +
sector1ImageMap + sector2ImageMap;
Any ideas? |
Re: clickable pie chart |
Posted by Peter Kwan on Dec-24-2010 00:37 |
|
Hi TL,
The image map created by ChartDirector already uses a different URL for each slice. Each URL should have different query parameters so you may distinguish which sector is being clicked.
If you would like to use certain specific URLs specified by your code, you may use:
String[] myURLs = {"aaaa.aspx", "bbbb.aspx", ...};
pcChart.addExtraField(myURLs);
String chartImageMap = pcChart.getHTMLImageMap("{noescape_url}{field0}", " ");
Hope this can help.
Regards
Peter Kwan |
Re: clickable pie chart |
Posted by TL on Dec-24-2010 01:23 |
|
Thank you Peter, I'll try that.
I have another Question:
I have the labels written on the segments. Now, when the segment is too small to contain the label, it makes the label be written on the next labels, too.
Is there any way to make label size dynamical? I mean that it will fit the segment size? |
Re: clickable pie chart |
Posted by Peter Kwan on Dec-24-2010 16:28 |
|
Hi TL,
By "segments", are you referring to slices in a pie chart (as your previous message is about a pie chart), or about bar segments in a stacked bar chart?
If it is about slices in a pie chart, you may use "Side Label Layout" so that the labels would not overlap. See the "Side Label Layout" sample code for an example.
If it is about labels in a stacked bar chart, by default, ChartDirector should not display the label if the bar segment is too small, although you may override it with setMinLabelSize to force all labels to display.
Unluckily, ChartDirector cannot automatically resize any label to fit a certain area. If your original label is of 8pt font size, resizing it even slightly smaller (eg. 25% smaller) will make them almost impossible to read. You may consider to simply hide the label (which is the default in ChartDirector).
Hope this can help.
Regards
Peter Kwan |
Re: clickable pie chart |
Posted by TL on Dec-24-2010 16:43 |
|
Thank you,
I meant, indeed, slices... my mistake. |
Re: clickable pie chart |
Posted by TL on Dec-26-2010 19:31 |
|
Thank you Peter, for your great help.
one more thing:
When I click on a slice of the pie, before the page is reloaded, for a moment I see a white line on the perimeter of the slice.
How can I avoid that? |
Re: clickable pie chart |
Posted by TL on Dec-26-2010 22:19 |
|
And another question:
In the examples I didn't see a definition of the temporary directory where the images supposed to be saved. Does ChartDirector creates the tempDir automatically? And if so, where can I find this directory? |
Re: clickable pie chart |
Posted by TL on Dec-26-2010 23:30 |
|
how can I define specific color for a slice? e.g. I want the slice that represents "something" to be always green, while the slice representing "something else" to be always red. |
Re: clickable pie chart |
Posted by TL on Dec-27-2010 17:58 |
|
In regard to the colors for each slice - I found the solution in previous question in the forum.
Thank you any way, and I'll glad to get answers to my other questions.
TL. |
Re: clickable pie chart |
Posted by Peter Kwan on Dec-28-2010 01:38 |
|
Hi TL,
The "white line on the perimeter of the slice" when it is clicked is a feature of some browsers and is not related to ChartDirector. It also depends on your browser brand, version and configuration.
For example, if the browser is configured so that people can navigate the links using the keyboard (so people can use the "tab" key to jump from one link to the other link), the browser may highlight a clickable region when the link is in focus (so that people may know which link is active). When you click on a link, it is in focus and therefore the browser highlighted it.
To remove the highlight, please refer to your browser documentation for details. Some browsers may use the "hidefocus='true'" attribute in the <IMG> tag to disable the highlight. Some browsers may use "this.blur();" in the Javascript onfocus event handler. Some browsers may use the CSS outline attribute to disable the outline when a <A> or <AREA> tag is in focus or active, etc..
Hope this can help.
Regards
Peter Kwan |
Re: clickable pie chart |
Posted by TL on Dec-28-2010 16:34 |
|
Thank you very much!
What about the temporary directory? I still wonder where can I find it, and whether old files automatically deleted?
Can I define my own path to tempDir ?
Thank you for your great help!
TL. |
Re: clickable pie chart |
Posted by Peter Kwan on Dec-29-2010 01:55 |
|
Hi TL,
ChartDirector does not need to create temporary files. So by default, ChartDirector will not create any temporary files (although you can force it to use temporary files if you like by using BaseChart.makeTmpFile).
Hope this can help.
Regards
Peter Kwan |
Re: clickable pie chart |
Posted by TL on Dec-29-2010 16:24 |
|
Hi Peter.
I really would like to know how Chart Director creates the images.
I thought it creates the image, save it to a temporary directory, and than exports it to the web page.
But according to you, I was wrong...
What really happens?
Thank you,
TL. |
Re: clickable pie chart |
Posted by Peter Kwan on Dec-30-2010 01:20 |
|
Hi TL,
In HTML, an <IMG> tag is used for an image. The <IMG> tag is not the image, but just contain a URL. The browser will send a request to the server using the URL to obtain the image. When ChartDirector sees the browser request, it will send the chart image (which is stored in memory) to the browser as a MIME stream (such as a MIME stream of type "image/png"), just like any other ordinary image.
Sometimes people do not want to use memory to store images. If this is the case, ChartDirector allows you to use makeTmpFile to create the chart image as a file on the hard disk.
Hope this can help.
Regards
Peter Kwan |
|