|
check box functionality in chart directory |
Posted by PBasam on Sep-10-2011 18:49 |
|
Hi,
We are using Chart Directory as per our requirement. But we need to change my requirement as per our client. Our client wants to change the select and deselect for the inside legend box. We need to check box functionality. Otherwise Hyperlink for legend box to display chart. Clients want to change chart in dynamically. Could you please provide me alternate solution?
please find the attached document and below code.
<%@page import="ChartDirector.*" %>
<%
double[] data = {25, 18, 15, 12, 8, 30, 35};
String[] labels = {"Labor", "Licenses", "Taxes", "Legal", "Insurance", "Facilities",
"Production"};
PieChart c = new PieChart(450, 270);
c.setPieSize(150, 135, 100);
c.addLegend(330, 60);
c.setLabelFormat("{percent}%");
c.setData(data, labels);
c.setSectorStyle(Chart.RoundedEdgeShading, 0xffffff, 1);
String chart1URL = c.makeSession(request, "chart1");
String imageMap1 = c.getHTMLImageMap("", "",
"title='{label}: US${value}K ({percent}%)'");
%>
<html>
<body style="margin:5px 0px 0px 5px">
<div style="font-size:18pt; font-family:verdana; font-weight:bold">
Pie Chart with Legend (1)
</div>
<hr color="#000080">
<div style="font-size:9pt; font-family:verdana; margin-bottom:1.5em">
<a href="viewsource.jsp?file=<%=request.getServletPath()%>">View Source Code</a>
</div>
<img src='<%=response.encodeURL("getchart.jsp?"+chart1URL)%>'
usemap="#map1" border="0">
<map name="map1"><%=imageMap1%></map>
</body>
</html>
Regards,
PBasam.
|
Re: check box functionality in chart directory |
Posted by Peter Kwan on Sep-13-2011 00:41 |
|
Hi PBasam,
The "check box" control is a feature of HTML and is not related to ChartDirector. If you need a "check box", please use HTML to create the "check box". For example:
<input type="checkbox" name="Labor" value="1" /> <span style='font-family:Webdings;color:#FF3333'><</span> Labor
When the user clicks on the checkboxes, and then presses the "Submit" button, the JSP that handles the request and redraw the pie chart based on what the user has selected. This is by constructing the data arrays based on what the user has selected, then use those arrays to create the charts.
For hypertext links, ChartDirector allows various objects (including legend entries) in charts to be clickable and be associated with a hypertext link. There is an example "Custom Clickable Objects" in the ChartDirector documentation that you may use as a reference. Of course, you may also use HTML to create hypertext links.
Hope this can help.
Regards
Peter Kwan |
Re: check box functionality in chart directory |
Posted by pbasam on Sep-13-2011 12:10 |
|
Thanks a lot for your response.
How to set the Zoom in; Zoom out for charts when user clicks on mouse move.
Could you please provide me the any API or code in chart directory?
Regards,
BasamP |
Re: check box functionality in chart directory |
Posted by Peter Kwan on Sep-14-2011 01:37 |
|
Hi pbasam,
For a pie chart, when the user clicks on a chart object (or move the mouse over a chart object), mouse events will be fired. You may put any code you like in the mouse event handler. For example, you may generate a more detail chart based on which slice the user has clicked. (In ChartDirector, we do not call this type of features as "zoom in".)
Currently, ChartDirector only has API designed for zoom in and out for XYCharts (not pie charts). For example, suppose the XY Chart is a line chart showing year of data. When the user clicks on a certain point, the chart can be updated to show a narrow range of data (say 3 months of data around the clicked point). There are two examples included in the ChartDirector distribution demonstrating these features. You may look for "Zoomable and Scrollable Charts" in the ChartDirector documentation index for details.
Hope this can help.
Regards
Peter Kwan |
|