steveonjava / widgetfx

Automatically exported from code.google.com/p/widgetfx
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

impossible to draw javafx.scene.chart.PieChart into a Widget obj #65

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

I see the applet working as expected but the docked one (into the widgetFx) 
showiong just the text ("Pie Chart").

What version of the product are you using? On what operating system?
javafx 1.2 and widgetfx 1.2

here the code 

import javafx.stage.Alert;
import javafx.scene.Scene;
import javafx.scene.chart.PieChart;
import javafx.scene.chart.PieChart3D;
import org.dataengine.widgets.DataAccess.LoadXMLData;
import org.dataengine.widgets.DataModel.StandardDataObject;
import javafx.scene.Group;
import org.widgetfx.Widget;
import org.widgetfx.config.Configuration;
import javafx.scene.control.Skin; 
import javafx.stage.Stage;
import javafx.scene.*;

/**
 * @author AlessioFimognari & harrythompson
 */

var standarddataobjects:StandardDataObject[];

var loadxmldata = LoadXMLData {
    onDone: function( data:StandardDataObject[] ) {
        standarddataobjects = data;
        makeseries();
    }
};

loadxmldata.loadData();

var series:PieChart.Data[];
function makeseries() {
    println("Making dataseries...");
    for (standarddataobject in standarddataobjects) {
        var value:Number = java.lang.Double.valueOf(standarddataobject.series);
        var datapoint = PieChart.Data { label: {standarddataobject.label} value: {value} action:function(){Alert.inform("{standarddataobject.label} {value}")}}
        insert datapoint into series;
    }
    println("Loading chart...");
    makechart();
}

function makechart() {
    Stage {
        scene   : Scene {
            height  : 320
            width   : 320
            content : PieChart {
                title           : "Pie Chart"
                //pieThickness  : 20
                startAngle      : 0
                scaleX          : 0.7
                scaleY          : 0.7
                translateX      : -95
                data            : series
            }
        }
    }
}

  var widget = Widget {
      width: 320;
      height: 240;
      aspectRatio: 320 / 240;
      content: PieChart {
                                            title           : "Pie Chart"
                                            //pieThickness  : 20
                                            startAngle      : 0
                                            scaleX          : 0.7
                                            scaleY          : 0.7
                                            translateX      : -95
                                            visible         : true
                                            data            : series
                                        };
  }

  return widget;

Original issue reported on code.google.com by Alef...@gmail.com on 6 Sep 2010 at 9:35