Sign in to follow this  
kimbitna

Chart Print Problem.

Recommended Posts

Hello.

 

I have a problem about printing.

 

I am using under code.

 

 

var myChart = new FusionCharts("/common/FusionChart/Charts/StackedColumn2DLine.swf", "myChartId", "800", "580", "0", "1");

myChart.render("chartContainer");

 

 

data='{"chart":{"showvalues":"0"},"dataset":[{"seriesname":"BEGINNING_INVENTORY","parentyaxis":"P","data":[{"value":"1537000000"},{"value":"1437000000"},{"value":"1537000000"},{"value":"1687000000"},{"value":"1487000000"},{"value":"1587000000"},{"value":"16965000000"},{"value":"15965000000"}]},{"seriesname":"ENDING_INVENTORY","parentyaxis":"P","data":[{"value":"1437000000"},{"value":"1537000000"},{"value":"1687000000"},{"value":"1487000000"},{"value":"1587000000"},{"value":"16965000000"},{"value":"15965000000"},{"value":"16812000000"}]},{"seriesname":"FINISHED_GOODS","parentyaxis":"S","data":[{"value":"48027000000"},{"value":"52027000000"},{"value":"49027000000"},{"value":"51027000000"},{"value":"45027000000"},{"value":"48027000000"},{"value":"49027000000"},{"value":"51400000000"}]},{"seriesname":"SEMI_FINISHED_GOODS","parentyaxis":"S","data":[{"value":"6801000000"},{"value":"7301000000"},{"value":"7001000000"},{"value":"6901000000"},{"value":"7601000000"},{"value":"7691000000"},{"value":"7681000000"},{"value":"7773000000"}]}],"categories":[{"category":[{"label":"JAN"},{"label":"FEB"},{"label":"MAR"},{"label":"APR"},{"label":"MAY"},{"label":"JUN"},{"label":"JUL"},{"label":"AUG"}]}]}';

 

 

Also, When I click radio button,

 

It renders another chart in the same div(chartContainer).

 

 

data='{"chart":{"showvalues":"0"},"dataset":[{"seriesname":"BEGINNING_INVENTORY","parentyaxis":"P","data":[{"value":"9272000000"},{"value":"32930000000"}]},{"seriesname":"ENDING_INVENTORY","parentyaxis":"P","data":[{"value":"24700000000"},{"value":"32777000000"}]},{"seriesname":"FINISHED_GOODS","parentyaxis":"S","data":[{"value":"293162000000"},{"value":"100427000000"}]},{"seriesname":"SEMI_FINISHED_GOODS","parentyaxis":"S","data":[{"value":"43296000000"},{"value":"15454000000"}]}],"categories":[{"category":[{"label":"1"},{"label":"2"}]}]}';

 

I had a problems then, I can print just first chart. and if chart renders another one, print function doesn't work.

 

I am using chrome. so I try to do managed print mozila, but it works samely.

 

Please help me ,,TT

 

 

I attached code.

 

and it change data for clicking monthly/quaterly/half-yearly radio button.

 

and up-side print button works for printing.

 

 

 

 

----------------------------------

 

 

 

 

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript" src="/common/js/jquery.js"></script>

<script type="text/javascript" src="/common/js/jquery.dataTables.js"></script>

<link href="common/css/main.css" rel="stylesheet" type="text/css" />

<link href="common/css/google.css" rel="stylesheet" type="text/css" />

<style type="text/css" title="currentStyle">

@import "/common/css/Table/demo_table.css";

</style>

<script type="text/javascript" src="/common/FusionChart/Charts/FusionCharts.js"></script>

 

<style>

.tdsize{width:800px; height:600px; border:1px solid}

</style>

 

<script type="text/javascript">

 

var myChartId;

 

 

function displayChart(value){

var myChart = new FusionCharts("/common/FusionChart/Charts/StackedColumn2DLine.swf", "myChartId", "800", "580", "0", "1");

myChart.render("chartContainer");

 

if(value==1){

data='{"chart":{"showvalues":"0"},"dataset":[{"seriesname":"BEGINNING_INVENTORY","parentyaxis":"P","data":[{"value":"1537000000"},{"value":"1437000000"},{"value":"1537000000"},{"value":"1687000000"},{"value":"1487000000"},{"value":"1587000000"},{"value":"16965000000"},{"value":"15965000000"}]},{"seriesname":"ENDING_INVENTORY","parentyaxis":"P","data":[{"value":"1437000000"},{"value":"1537000000"},{"value":"1687000000"},{"value":"1487000000"},{"value":"1587000000"},{"value":"16965000000"},{"value":"15965000000"},{"value":"16812000000"}]},{"seriesname":"FINISHED_GOODS","parentyaxis":"S","data":[{"value":"48027000000"},{"value":"52027000000"},{"value":"49027000000"},{"value":"51027000000"},{"value":"45027000000"},{"value":"48027000000"},{"value":"49027000000"},{"value":"51400000000"}]},{"seriesname":"SEMI_FINISHED_GOODS","parentyaxis":"S","data":[{"value":"6801000000"},{"value":"7301000000"},{"value":"7001000000"},{"value":"6901000000"},{"value":"7601000000"},{"value":"7691000000"},{"value":"7681000000"},{"value":"7773000000"}]}],"categories":[{"category":[{"label":"JAN"},{"label":"FEB"},{"label":"MAR"},{"label":"APR"},{"label":"MAY"},{"label":"JUN"},{"label":"JUL"},{"label":"AUG"}]}]}';

}else{

data='{"chart":{"showvalues":"0"},"dataset":[{"seriesname":"BEGINNING_INVENTORY","parentyaxis":"P","data":[{"value":"9272000000"},{"value":"32930000000"}]},{"seriesname":"ENDING_INVENTORY","parentyaxis":"P","data":[{"value":"24700000000"},{"value":"32777000000"}]},{"seriesname":"FINISHED_GOODS","parentyaxis":"S","data":[{"value":"293162000000"},{"value":"100427000000"}]},{"seriesname":"SEMI_FINISHED_GOODS","parentyaxis":"S","data":[{"value":"43296000000"},{"value":"15454000000"}]}],"categories":[{"category":[{"label":"1"},{"label":"2"}]}]}';

}

$('#data').html(data);

myChart.setJSONData(data);

myChart.render("chartContainer");

}

 

 

 

function printIt(printThis)

{

 

FusionCharts.getObjectReference('myChartId').print();

}

 

 

function changeData(value){

 

displayChart(value);

 

}

</script>

 

</head>

 

 

<body onload="displayChart(1)">

<!-- wrapper -->

<div id="wrapper">

<div id="data"></div>

<div class="google-header-bar">

<div class="header">

<div id ="header-top" class ="header-top">

 

<table>

<tr>

<td>

<a id="logo" class="logo" href=#><h1></h1></a></td>

<td>

</td></tr>

</table>

<div style="text-align: right; width:95%">

<a href="#" id ="save" onclick=""><b>Save | </b> </a>

<a href="javascript:printIt(document.getElementById('chartContainer').innerHTML)">

<b>Print</b>

</a>

</div>

</div>

</div>

</div>

 

<!-- content area -->

<div>

<br></br>

<div id="dynamic"></div>

<table>

<tr>

<td width="5%">

</td>

<td class="tdsize">

<div id="content-area-inner-main" style='padding:10px 10px 10px 10px'>

<div id="messageBox" style="margin-left:10px; margin-right:10px; display:none;"></div>

<div id = "Container">

<div id="chartContainer"></div>

</div>

</div>

</td>

<td style='width:250px; text-align:left;'>

 

<div id ="option_content" style="padding: 0px 0px 0px 20px">

 

<h1>Condition</h1><br>

<form id="frm_form" name="frm_form">

<div id="years"></div><br></br>

<input type="hidden" name="alias" value="BEGINNING_INVENTORY" />

<input type="hidden" name="alias" value="ENDING_INVENTORY" />

<input type="hidden" name="alias" value="FINISHED_GOODS" />

<input type="hidden" name="alias" value="SEMI_FINISHED_GOODS" />

<input type="hidden" name="axistype" value="P" />

<input type="hidden" name="axistype" value="P" />

<input type="hidden" name="axistype" value="S" />

<input type="hidden" name="axistype" value="S" />

<div>

<ul>

<li>

<input type="radio" name="sql" checked="1" value="getFIN_COSTOFSALES_aYear" onclick="changeData(1)" ><font class="radio_option">Monthly</font></input><br></br>

<input type="radio" name="sql" value="getFIN_COSTOFSALES_Quarter" onclick="changeData(2)" ><font class="radio_option">Quaterly</font></input><br></br>

<input type="radio" name="sql" value="getFIN_COSTOFSALES_Half" onclick="changeData(1)" ><font class="radio_option">Half-yearly</font></input>

</li>

</ul>

</div>

</form>

 

<br></br>

<div>

<b>Display Mode :</b>

 

</div>

<table style="width:150px;">

<tr>

 

<td style='text-align:left; padding:10px 0px 0px 0px'>

<input type="radio" id="dpType" name="dpType" checked="1" value="chart" onclick="changeData()">

<font class="radio_option">Chart</font></input></td>

<td style='text-align:left; padding:10px 0px 0px 0px'>

<input type="radio" id="dpType" name="dpType" value="table" onclick="changeData()">

<font class="radio_option">Table</font></input></td>

 

</tr></table>

<br></br>

<div>

<b>Description :</b>

<div id="description" style='text-align:left; padding:10px 0px 0px 0px'></div>

</div>

</td>

<td width="5%">

</td>

</tr>

</table>

</div>

</div>

</body>

</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