Jump to content
JChartFX Community

jjlink

Members
  • Posts

    7
  • Joined

  • Last visited

Posts posted by jjlink

  1.  Juan, the issue appears to be the following:

    when you hard code the values it adds them up to create the whole pie, then divides each piece.

     

    when you use a variable it concatenates the values to come up with the size of the pie.

     

    function doData() {
    var varUsable = "<?php echo $Usable; ?>";
    var varOverhead = "<?php echo $Overhead; ?>";
    chart1.getDataSourceSettings().getFields().clear();
    var items = [{
    /*"Country": "Costa Rica",
    "Value": 3711095
    }, {
    "Country": "El Salvador",
    "Value": 6125782
    }, {
    "Country": "Guatemala",
    "Value": 11085025
    }, {
    "Country": "Honduras",
    "Value": 6347658
    }, {
    "Country": "Nicaragua",
    "Value": 4935148*/
    "Country": "Array Overhead",
    "Value": 30
    }, {
    "Country": "Usable",
    "Value": varUsable 
    }];
    /*var second = items[1];
    second["Value"] = varOverhead;*/
    chart1.setDataSource(items);
    }

     

    the value of varUsable is 58. the pie them becomes 3058. if I hard code the value to be 58, the pie becomes 88.

  2.  Juan, I can tweak the data i.e.

    var first = items[0];

    first["Value"] = aNumberVariable;

     

    but when I do the whole pie does not show up,just a sliver.

    function doData() {
    var varUsable = "<?php echo $Usable; ?>";
    var varOverhead = "<?php echo $Overhead; ?>";
    chart1.getDataSourceSettings().getFields().clear();
    var items = [{
    /*"Country": "Costa Rica",
    "Value": 3711095
    }, {
    "Country": "El Salvador",
    "Value": 6125782
    }, {
    "Country": "Guatemala",
    "Value": 11085025
    }, {
    "Country": "Honduras",
    "Value": 6347658
    }, {
    "Country": "Nicaragua",
    "Value": 4935148*/
    "Country": "Array Overhead",
    "Value": 3711095
    }, {
    "Country": "Usable",
    "Value": 100
    }];
    var second = items[1];
    second["Value"] = varOverhead;
    chart1.setDataSource(items);
    }

     

    thanks so much for the help, this is really cool.

  3.  can I pass a variable into the array. I am running php against a db to get the values. wondering if I can pass that into a value in the array? 

    function doData() {
    chart1.getDataSourceSettings().getFields().clear();
    var items = [{
    /*"Country": "Costa Rica",
    "Value": 3711095
    }, {
    "Country": "El Salvador",
    "Value": 6125782
    }, {
    "Country": "Guatemala",
    "Value": 11085025
    }, {
    "Country": "Honduras",
    "Value": 6347658
    }, {
    "Country": "Nicaragua",
    "Value": 4935148*/
    "Country": "Array Overhead",
    "Value": 3711095
    }, {
    "Country": "Usable",
    "Value": 10000
    }];
    chart1.setDataSource(items);
    }

×
×
  • Create New...