Package zephyropen.swing.gui.viewer

Source Code of zephyropen.swing.gui.viewer.HRMViewer

package zephyropen.swing.gui.viewer;

import com.googlecode.charts4j.Color;

import zephyropen.api.API;
import zephyropen.api.PrototypeFactory;
import zephyropen.command.Command;
import zephyropen.swing.TabbedFrame;
import zephyropen.util.google.GoogleChart;
import zephyropen.util.google.GoogleLineGraph;

public class HRMViewer extends AbstractViewer implements Viewer {
   
    public HRMViewer(API caller) {

      // TODO: super(api);??
        api = caller;
       
        charts = new GoogleChart[3];
        charts[0] = new GoogleLineGraph(PrototypeFactory.heart, "BPM", Color.RED);
        charts[1] = new GoogleLineGraph(PrototypeFactory.beat, "Seq#", Color.FIREBRICK);
        charts[2] = new GoogleLineGraph(PrototypeFactory.connection, "sec", Color.FORESTGREEN);

        // now build a frame for the charts
        frame = new TabbedFrame(charts);
    }

    public void update(Command command) {
        charts[0].add(command.get(PrototypeFactory.heart));
        charts[1].add(command.get(PrototypeFactory.beat));
        charts[2].add(String.valueOf(api.getDelta()));
    }
}
TOP

Related Classes of zephyropen.swing.gui.viewer.HRMViewer

TOP
Copyright © 2018 www.massapi.com. 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.