/*
 * Copyright (c) 2014 Paul Scherrer Institute. All rights reserved.
 */
package ch.psi.plot;

import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.swing.JPanel;

/**
 *
 */
public interface Plot<T extends PlotSeries> {

    public JPanel getChartPanel();
    
    //Request update on event loop
    public void update(boolean deferred);

    public void setUpdatesEnabled(boolean value);

    public boolean isUpdatesEnabled();

    //Generic properties
    public void setTitle(String title);

    public String getTitle();

    //Generic operations
    public void saveData(String filename) throws IOException;

    public BufferedImage getSnapshot();

    public void saveSnapshot(String filename, String format) throws IOException;

    //Series list management
    public void addSeries(T series);

    public void addSeries(T[] series);

    public void removeSeries(T series);    

    public T getSeries(String name);
    
    public T getSeries(int index);

    public int getNumberOfSeries();

    public void updateSeries(T series);

    public void requestSeriesUpdate(final T series);

    public double[][] getSeriesData(final T series);

    public T[] getAllSeries();

    public void clear();    //remove all series
    
    //Axis
    public enum AxisId {
        X, Y, Z;
    };

    public Axis getAxis(AxisId id);               
}
