Sign in to follow this  
dudiq

Flash And Javascript Renders Are Different After Setting Props

Recommended Posts

Hi All.

 

Why when you change 'BorderThickness' property a chart that was drawn on a flash - everything is normal, and chart, drawn by javascript, leaves for the size of his set?

 

is it ok? And what is solution of this problem?

 

<html>
   <head>
       <script language="JavaScript" src="fusionCharts.js"></script>
       <script language="JavaScript" src="jquery-1.4.2.min.js"></script>
       <style>
           #pie1, #pie2 {
               width: 500px;
               height: 300px;
               border: 1px solid black;
               position: relative;
               overflow: hidden;
           }
       </style>
   </head>

   <body>
       <div id="pie1" align="center"></div>
       <div id="pie2" align="center"></div>
       <input type="button" value="click me">
       <input type="text" id="text" value="2">

       <script type="text/javascript">
           $(document).ready(function(){
               function getXml() {
                   var xml = '<chart animation=\"0\" labeldisplay=\"None\"><colorrange></colorrange><set label=\"Jan\" value=\"462\"></set><set label=\"Feb\" value=\"857\"></set><set label=\"Mar\" value=\"671\"></set><set label=\"Apr\" value=\"494\"></set><set label=\"May\" value=\"761\"></set><set label=\"Jun\" value=\"960\"></set><set label=\"Jul\" value=\"629\"></set><set label=\"Aug\" value=\"622\"></set><set label=\"Sep\" value=\"376\"></set><set label=\"Oct\" value=\"494\"></set><set label=\"Nov\" value=\"761\"></set><set label=\"Dec\" value=\"960\"></set></chart>';
                   return xml;
               }
               function createChart(id, prop){
                   var chartInitProps = {
                       swfUrl : "Pie3D.swf",
                       id : "ch1",
                       width: 500,
                       height: 300,
                       debugMode : 0,
                       registerWithJS : 1
                   }
                   if (prop != undefined){
                       chartInitProps = jQuery.extend(chartInitProps, prop);
                   }
                   var chart = new FusionCharts(chartInitProps);
                   var xml = getXml();
                   chart.setDataXML(xml);
                   chart.render(id);
                   return chart;
               }

               var m1 = createChart("pie1", {id: "ch1"});
               var m2 = createChart("pie2", {id: "ch2", renderer: 'javascript'});

               $("input[type=button]").click(function(){
                   var value = $("#text").val();
                   m1.setChartAttribute("BorderThickness", value);
                   m2.setChartAttribute("BorderThickness", value);
               });
           })
       </script>
   </body>
</html>

post-8164-096817800 1288786303_thumb.jpg

Edited by dudiq

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