Sign in to follow this  
OMMPAVAN

Drill Down Charts With Different Types

Recommended Posts

Hai

I have implemented 4 level drill down chart .now i am trying for 4 charts are four types .like first level is pie second level is bar ..and so on ....For main chart it is getting ok because we are giving swf file name.From second level i am using configureLink function my issue is if i give pie for second level all other levels getting pie .can u check my code have to implement any thing.

 

 

 

<%@page import="org.apache.commons.lang.StringUtils"%>

<%

String chartSWF = request.getParameter("chartSWF");

String strURL = request.getParameter("strURL");

String strXML = request.getParameter("strXML");

String chartId = request.getParameter("chartId");

String chartWidthStr = request.getParameter("chartWidth");

String chartHeightStr = request.getParameter("chartHeight");

String debugModeStr = request.getParameter("debugMode");

String registerWithJSStr = request.getParameter("registerWithJS");

 

String childCharts = request.getParameter("childCharts");

String childChartOneSWF = "Column3D.swf";

String childChartTwoSWF = "Bar3D.swf";

String childChartThreeSWF = "Column3D.swf";

//Childern Chart SWF Files

if (chartSWF.contains(",")) {

String childChartsSWFFile[] = chartSWF.split(",");

if (childChartsSWFFile.length > 0) {

chartSWF = childChartsSWFFile[0];

}

if (childChartsSWFFile.length > 1) {

childChartOneSWF = childChartsSWFFile[1];

}

if (childChartsSWFFile.length > 2) {

childChartTwoSWF = childChartsSWFFile[2];

}

if (childChartsSWFFile.length > 3) {

childChartThreeSWF = childChartsSWFFile[3];

}

}

 

int chartWidth = 600;

int chartHeight = 300;

boolean debugMode = false;

boolean registerWithJS = true;

int debugModeInt = 0;

int regWithJSInt = 0;

 

if (null != chartWidthStr && !chartWidthStr.equals("")) {

if (StringUtils.containsIgnoreCase(chartWidthStr, "per")) {

chartWidthStr = chartWidthStr.toLowerCase();

chartWidthStr = StringUtils.replace(chartWidthStr, "per",

"%");

}

}

if (null != chartHeightStr && !chartHeightStr.equals("")) {

if (StringUtils.containsIgnoreCase(chartHeightStr, "per")) {

chartHeightStr = chartHeightStr.toLowerCase();

chartHeightStr = StringUtils.replace(chartHeightStr, "per",

"%");

}

}

if (null != debugModeStr && !debugModeStr.equals("")) {

debugMode = new Boolean(debugModeStr).booleanValue();

debugModeInt = boolToNum(new Boolean(debugMode));

}

if (null != registerWithJSStr && !registerWithJSStr.equals("")) {

registerWithJS = new Boolean(registerWithJSStr).booleanValue();

regWithJSInt = boolToNum(new Boolean(registerWithJS));

}

%>

<div id='<%=chartId%>Div' align='center'>Chart</div>

<div id='<%=chartId%>ExportData'></div>

<script type='text/javascript'>

var chart_<%=chartId%> = new FusionCharts("<%=chartSWF%>", "<%=chartId%>","<%=chartWidthStr%>"

,"<%=chartHeightStr%>", "<%=debugModeInt%>","<%=regWithJSInt%>");

 

<%if (strXML.equals("")) {%>

chart_<%=chartId%>.setDataURL("<%=strURL%>");

 

<%} else {%>

// Provide entire XML data using dataXML method

chart_<%=chartId%>.setDataXML("<%=strXML%>");

<%}%>

 

/* FusionCharts.setCurrentRenderer('javascript'); Forcing to render by javascript*/

 

chart_<%=chartId%>.configure("ChartNoDataText", "No Current Records To Display");//when there is no reocords message

chart_<%=chartId%>.render("<%=chartId%>Div");

 

 

chart_<%=chartId%>.configureLink (

{

swfUrl :"<%=childChartThreeSWF%>"

 

}, 0);

 

chart_<%=chartId%>.configureLink (

{

swfUrl : "<%=childChartTwoSWF%>"

 

}, 0);

 

chart_<%=chartId%>.configureLink (

{

swfUrl : "<%=childChartOneSWF%>"

 

}, 0);

 

 

 

//Below Code for Exporting chart as .jpeg,.png and .pdf files

var myExportComponent = new FusionChartsExportObject("fcExporter1", "FCExporter.swf");

myExportComponent.render("<%=chartId%>ExportData");

 

</script>

<%!/**

* Converts a Boolean value to int value<br>

* @param bool Boolean value which needs to be converted to int value

* @return int value correspoding to the boolean : 1 for true and 0 for false

*/

public int boolToNum(Boolean bool) {

int num = 0;

if (bool.booleanValue()) {

num = 1;

}

return num;

}%>

 

Share this post


Link to post
Share on other sites
Guest Sashibhusan

Hi,

 

The correct syntax for using FusionCharts JavaScript function "configureLink()" is:

 

Ref. Code:

myChart.configureLink("Parameter1","Parameter2");

 

Where, Parameter1: The object containing all configurations (chart and overlay-Button)

and Parameter2: A number which denotes the level being configured

 

Since, you have set the second parameter (Parameter2) for all the "configureLink()" functions call to "0", this is only applied for the first level of drilldown.

 

For more information on "FusionCharts JavaScript API - Functions", please follow the link below:

http://docs.fusioncharts.com/charts/contents/?JavaScript/API/Methods.html

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this