Package com.google.gwt.visualization.client

Examples of com.google.gwt.visualization.client.DataTable


      // has been loaded.
      Runnable onLoadCallback = new Runnable() {
        public void run() {

          // Create nodes table with some data
          DataTable nodes = DataTable.create();
          nodes.addColumn(DataTable.ColumnType.NUMBER, "id");
          nodes.addColumn(DataTable.ColumnType.STRING, "text");
          nodes.addRow();
          int i = 0;
          nodes.setValue(i, 0, 1);
          nodes.setValue(i, 1, "Node 1");
          nodes.addRow();
          i++;
          nodes.setValue(i, 0, 2);
          nodes.setValue(i, 1, "Node 2");
          nodes.addRow();
          i++;
          nodes.setValue(i, 0, 3);
          nodes.setValue(i, 1, "Node 3");

          // Create links table with some data
          DataTable links = DataTable.create();
          links.addColumn(DataTable.ColumnType.NUMBER, "from");
          links.addColumn(DataTable.ColumnType.NUMBER, "to");
          links.addRow();
          i = 0;
          links.setValue(i, 0, 1);
          links.setValue(i, 1, 2);
          links.addRow();
          i++;
          links.setValue(i, 0, 1);
          links.setValue(i, 1, 3);
          links.addRow();
          i++;
          links.setValue(i, 0, 2);
          links.setValue(i, 1, 3);


          // Create links table with some data
          DataTable packages = DataTable.create();
          packages.addColumn(DataTable.ColumnType.NUMBER, "from");
          packages.addColumn(DataTable.ColumnType.NUMBER, "to");
          packages.addColumn(DataTable.ColumnType.NUMBER, "duration");
          packages.addRow();
          i = 0;
          packages.setValue(i, 0, 1);
          packages.setValue(i, 1, 2);
          packages.setValue(i, 2, 5);
          packages.addRow();
          i++;
          packages.setValue(i, 0, 1);
          packages.setValue(i, 1, 3);
          packages.setValue(i, 2, 3);
          packages.addRow();
          i++;
          packages.setValue(i, 0, 2);
          packages.setValue(i, 1, 3);
          packages.setValue(i, 2, 1);
         
          // Create options
          Network.Options options = Network.Options.create();
          options.setWidth("300px");
          options.setHeight("300px");
View Full Code Here


    // Create a callback to be called when the visualization API
    // has been loaded.
  Runnable onLoadCallback = new Runnable() {
      public void run() {
      // create a data table
      DataTable data = DataTable.create();
      data.addColumn(DataTable.ColumnType.DATETIME, "start");
      data.addColumn(DataTable.ColumnType.DATETIME, "end");
      data.addColumn(DataTable.ColumnType.STRING, "content");
      data.addColumn(DataTable.ColumnType.STRING, "group");

        DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss");

        // fill the table with some random data
        int row = 0;
        for (int truck = 11; truck < 15; truck++) {
          Date date = dtf.parse("2010-12-14 08:00:00");
          for (int i = 0; i < 8; i++) {
            int diffHour = 1 * 4 * (Math.random() < 0.2 ? 1 : 0);
            date.setTime(date.getTime() + diffHour * 60 * 60 * 1000);
           
            Date start = new Date(date.getTime());
           
            diffHour = 2 + (int)Math.floor(Math.random()*4);
            date.setTime(date.getTime() + diffHour * 60 * 60 * 1000);

            Date end = new Date(date.getTime());

            String orderText = "Order " + row;
            if (Math.random() < 0.25)
              orderText = "<img src='img/product-icon.png' style='width:24px; height:24px; vertical-align: middle'> " + orderText;
            orderText = "<div title='Order " + row + "' class='order'>" + orderText + "</div>";
           
            String truckText = "<img src='img/truck-icon.png' style='width:24px; height:24px; vertical-align: middle'> " +
              "Truck " + truck;
           
            data.addRow();
            data.setValue(row, 0, start);
            data.setValue(row, 1, end);
            data.setValue(row, 2, orderText);
            data.setValue(row, 3, truckText);

            row++;
          }
        }       
       
View Full Code Here

 
  /**
   * Add a new package to the network
   */
  void addPackage() {
      DataTable packages = DataTable.create();
      packages.addColumn(DataTable.ColumnType.NUMBER, "from");
      packages.addColumn(DataTable.ColumnType.NUMBER, "to");
      packages.addRow();
      int i = 0;
      packages.setValue(i, 0, 1);
      packages.setValue(i, 1, 2);

      network.addPackages(packages);
  }
View Full Code Here

      packageStep = -0.1;
    if (packageProgress < 0.0 - packageStep)
      packageStep = 0.1;
    packageProgress += packageStep;
   
      DataTable packages = DataTable.create();
      packages.addColumn(DataTable.ColumnType.NUMBER, "id");
      packages.addColumn(DataTable.ColumnType.NUMBER, "from");
      packages.addColumn(DataTable.ColumnType.NUMBER, "to");
      packages.addColumn(DataTable.ColumnType.NUMBER, "progress");
      packages.addColumn(DataTable.ColumnType.STRING, "title");
      packages.addRow();
      int i = 0;
      packages.setValue(i, 0, packageId);
      packages.setValue(i, 1, 2);
      packages.setValue(i, 2, 3);
      packages.setValue(i, 3, packageProgress);
      packages.setValue(i, 4, "This is a manual package");

      network.addPackages(packages);
  }
View Full Code Here

      network.addPackages(packages);
  }
 
  void deletePackage() {
      DataTable packages = DataTable.create();
      packages.addColumn(DataTable.ColumnType.NUMBER, "id");
      packages.addColumn(DataTable.ColumnType.NUMBER, "from");
      packages.addColumn(DataTable.ColumnType.NUMBER, "to");
      packages.addColumn(DataTable.ColumnType.STRING, "action");
      packages.addRow();
      int i = 0;
      packages.setValue(i, 0, packageId);
      packages.setValue(i, 3, "delete");

      network.addPackages(packages);
  }
View Full Code Here

    // Create a callback to be called when the visualization API
    // has been loaded.
  Runnable onLoadCallback = new Runnable() {
      public void run() {
      // create a data table
      DataTable data = DataTable.create();
      data.addColumn(DataTable.ColumnType.DATETIME, "start");
      data.addColumn(DataTable.ColumnType.DATETIME, "end");
      data.addColumn(DataTable.ColumnType.STRING, "content");

        DateTimeFormat dtf = DateTimeFormat.getFormat("yyyy-MM-dd");

        // fill the table with some data
        data.addRow();
        data.setValue(0, 0, dtf.parse("2010-08-23"));
        data.setValue(0, 1, dtf.parse("2010-08-30"));
        data.setValue(0, 2, "Project A");
        data.addRow();
        data.setValue(1, 0, dtf.parse("2010-08-28"));
        data.setValue(1, 2, "Meeting");
        data.addRow();
        data.setValue(2, 0, dtf.parse("2010-09-02"));
        data.setValue(2, 2, "Phone Call");
        data.addRow();
        data.setValue(3, 0, dtf.parse("2010-09-03"));
        data.setValue(3, 2, "Finished");

        // create options
        Timeline.Options options = Timeline.Options.create();
        options.setWidth("100%");
        //options.setHeight("200px");
View Full Code Here

      // has been loaded.
      Runnable onLoadCallback = new Runnable() {
        public void run() {

          // Create nodes table with some data
          DataTable nodes = DataTable.create();
          nodes.addColumn(DataTable.ColumnType.NUMBER, "id");
          nodes.addColumn(DataTable.ColumnType.STRING, "text");
          nodes.addRow();
          int i = 0;
          nodes.setValue(i, 0, 1);
          nodes.setValue(i, 1, "Node 1");
          nodes.addRow();
          i++;
          nodes.setValue(i, 0, 2);
          nodes.setValue(i, 1, "Node 2");
          nodes.addRow();
          i++;
          nodes.setValue(i, 0, 3);
          nodes.setValue(i, 1, "Node 3");

          // Create links table with some data
          DataTable links = DataTable.create();
          links.addColumn(DataTable.ColumnType.NUMBER, "from");
          links.addColumn(DataTable.ColumnType.NUMBER, "to");
          links.addRow();
          i = 0;
          links.setValue(i, 0, 1);
          links.setValue(i, 1, 2);
          links.addRow();
          i++;
          links.setValue(i, 0, 1);
          links.setValue(i, 1, 3);
          links.addRow();
          i++;
          links.setValue(i, 0, 2);
          links.setValue(i, 1, 3);

          // Create options
          Network.Options options = Network.Options.create();
          options.setWidth("300px");
          options.setHeight("300px");
View Full Code Here

    // Create a callback to be called when the visualization API
    // has been loaded.
    Runnable onLoadCallback = new Runnable() {
      public void run() {
        // Create nodes table with some data
        DataTable nodes = DataTable.create();
        nodes.addColumn(DataTable.ColumnType.NUMBER, "id");
        nodes.addColumn(DataTable.ColumnType.STRING, "text");

        nodes.addRow();
        int i = 0;
        nodes.setValue(i, 0, 1);
        nodes.setValue(i, 1, "Node 1");
        nodes.addRow();
        i++;
        nodes.setValue(i, 0, 2);
        nodes.setValue(i, 1, "Node 2");
        nodes.addRow();
        i++;
        nodes.setValue(i, 0, 3);
        nodes.setValue(i, 1, "Node 3");

        // Create links table with some data
        DataTable links = DataTable.create();
        links.addColumn(DataTable.ColumnType.NUMBER, "from");
        links.addColumn(DataTable.ColumnType.NUMBER, "to");

        links.addRow();
        i = 0;
        links.setValue(i, 0, 1);
        links.setValue(i, 1, 2);
        links.addRow();
        i++;
        links.setValue(i, 0, 1);
        links.setValue(i, 1, 3);
        links.addRow();
        i++;
        links.setValue(i, 0, 2);
        links.setValue(i, 1, 3);

        // Create links table with some data
        DataTable packages = DataTable.create();
        packages.addColumn(DataTable.ColumnType.NUMBER, "from");
        packages.addColumn(DataTable.ColumnType.NUMBER, "to");
        packages.addColumn(DataTable.ColumnType.NUMBER, "duration");
        packages.addRow();
        i = 0;
        packages.setValue(i, 0, 1);
        packages.setValue(i, 1, 2);
        packages.setValue(i, 2, 5);
        packages.addRow();
        i++;
        packages.setValue(i, 0, 1);
        packages.setValue(i, 1, 3);
        packages.setValue(i, 2, 3);
        packages.addRow();
        i++;
        packages.setValue(i, 0, 2);
        packages.setValue(i, 1, 3);
        packages.setValue(i, 2, 1);

        // Create options
        Network.Options options = Network.Options.create();
        options.setWidth("300px");
        options.setHeight("300px");
View Full Code Here

 
  /**
   * Add a new package to the network
   */
  void addPackage() {
    DataTable packages = DataTable.create();
    packages.addColumn(DataTable.ColumnType.NUMBER, "from");
    packages.addColumn(DataTable.ColumnType.NUMBER, "to");
    packages.addRow();
    int i = 0;
    packages.setValue(i, 0, 1);
    packages.setValue(i, 1, 2);

    network.addPackages(packages);
  }
View Full Code Here

      packageStep = -0.1;
    if (packageProgress < 0.0 - packageStep)
      packageStep = 0.1;
    packageProgress += packageStep;

    DataTable packages = DataTable.create();
    packages.addColumn(DataTable.ColumnType.NUMBER, "id");
    packages.addColumn(DataTable.ColumnType.NUMBER, "from");
    packages.addColumn(DataTable.ColumnType.NUMBER, "to");
    packages.addColumn(DataTable.ColumnType.NUMBER, "progress");
    packages.addRow();
    int i = 0;
    packages.setValue(i, 0, packageId);
    packages.setValue(i, 1, 2);
    packages.setValue(i, 2, 3);
    packages.setValue(i, 3, packageProgress);

    network.addPackages(packages);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.visualization.client.DataTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.