HChart
jhplot

Class HChart

    • Field Detail

      • IndexPlot

        public static int IndexPlot
      • set

        public boolean set
    • Constructor Detail

      • HChart

        public HChart(String title,      int xsize,      int ysize,      int n1,      int n2,      boolean set)
        Create HChart canvas with a several chart plots
        Parameters:
        title - Title
        xsize - size in x direction
        ysize - size in y direction
        n1 - number of plots/graphs in x
        n2 - number of plots/graphs in y
        set - set or not the graph
      • HChart

        public HChart(String title,      int xs,      int ys)
        Construct a HChart canvas with a single plot/graph
        Parameters:
        title - Title for the canvas
        xs - size in x
        ys - size in y
      • HChart

        public HChart(String title,      int xs,      int ys,      boolean set)
        Construct a HChart canvas with a single plot/graph
        Parameters:
        title - Title for the canvas
        xs - size in x
        ys - size in y
        set - set or not the graph (boolean)
      • HChart

        public HChart(String title,      int xs,      int ys,      int n1,      int n2)
        Construct a HChart canvas with plots/graphs
        Parameters:
        title - Title for the canvas
        xs - size in x
        ys - size in y
        n1 - number of plots/graphs in x
        n2 - number of plots/graphs in y
      • HChart

        public HChart(String title)
        Construct a HChart canvas with a plot with the default parameters 600 by 400, and 10% space for the global title
        Parameters:
        title - Title
      • HChart

        public HChart()
        Construct a HChart canvas with a plot with the default parameters 600 by 400, and 10% space for the global title "Default"
    • Method Detail

      • resizePad

        public void resizePad(double widthScale,             double heightScale)
        Resize the current pad. It calculates the original pad sizes, and then scale it by a given factor. In this case, the pad sizes can be different.
        Parameters:
        widthScale - scale factor applied to the width of the current pad
        heightScale - scale factor applied the height of the current pad.
      • resizePad

        public void resizePad(int n1,             int n2,             double widthScale,             double heightScale)
        Resize the pad given by the inxX and indxY. It calculates the original pad sizes, and then scale it by a given factor. In this case, the pad sizes can be different.
        Parameters:
        n1 - the location of the plot in x
        n2 - the location of the plot in y
        widthScale - scale factor applied to the width of the current pad
        heightScale - scale factor applied the height of the current pad.
      • setLabelColor

        public void setLabelColor(Color labelColor)
        Se5t color of the labels.
        Parameters:
        labelColor -
      • setLabelFont

        public void setLabelFont(Font font)
        Set fonts of the labels.
        Parameters:
        font -
      • getLabelColor

        public Color getLabelColor()
        Get label color.
        Returns:
        color
      • setTickColor

        public void setTickColor(int axis,                Color tickColor)
        Set tick color
        Parameters:
        tickColor -
      • getTickColor

        public Color getTickColor()
        Get color of ticks.
        Returns:
        color
      • setTickFont

        public void setTickFont(Font tickFont)
        Set font of ticks
        Parameters:
        tickFont -
      • getTickFont

        public Font getTickFont()
        Get font of ticks.
        Returns:
      • visible

        public void visible(boolean vs)
        Set the canvas frame visible or not
        Parameters:
        vs - (boolean) true: visible, false: not visible
      • visible

        public void visible()
        Set the canvas frame visible
      • visible

        public void visible(int posX,           int posY)
        Set the canvas frame visible. Also set its location.
        Parameters:
        posX - - the x-coordinate of the new location's top-left corner in the parent's coordinate space;
        posY - - he y-coordinate of the new location's top-left corner in the parent's coordinate space
      • setTheme

        public void setTheme(String s)
        Set a custom theme for chart.. It can be: LEGACY_THEME, JFREE_THEME, DARKNESS_THEME
        Parameters:
        s - a theme, can be either LEGACY_THEME, JFREE_THEME, DARKNESS_THEME
      • destroy

        public void destroy()
        Remove the canvas frame
      • setFontAxisX

        public void setFontAxisX(Font f,                Color c)
        Set font and color for X-axis (for X-Y plots)
        Parameters:
        f - font
        c - color
      • setFontAxisY

        public void setFontAxisY(Font f,                Color c)
        Set font and color for Y-axis (for X-Y plots)
        Parameters:
        f - font
        c - color
      • setChartArea

        public void setChartArea()
        Make an Area chart.
      • setChartBar

        public void setChartBar()
        Make a Bar chart.
      • setChartBar3D

        public void setChartBar3D()
        Make a Bar chart in 3D.
      • setChartLine

        public void setChartLine()
        Make a line chart.
      • setChartLine

        public void setChartLine(double stroke)
        Make a line chart.
        Parameters:
        stroke - stroke width to draw the line
      • setChartPie

        public void setChartPie()
        Make a Pie chart.
      • setChartPie3D

        public void setChartPie3D()
        Make a Pie 3D chart.
      • setChartPolar

        public void setChartPolar()
        Make a chart using polar coordinates. Then use add() method to add X-Y values.
      • clearPlot

        public void clearPlot()
        Clear plot.
      • clearData

        public void clearData()
        Clear plot from the data
      • clear

        public void clear()
        Clear the current graph including graph settings. Note: the current graph is set by the cd() method
      • clear

        public void clear(int i1,         int i2)
        Clear the chart characterized by an index in X and Y. This method cleans the data and all graph settings.
        Parameters:
        i1 - location of the graph in X
        i2 - location of the graph in Y
      • clearAll

        public void clearAll()
        Clear all graphs from data and settings.
      • update

        public void update()
        Update all plots
      • setName

        public void setName(String title)
        Set global title to the current chart. Should be called before setChart* methods.
        Parameters:
        title - title
      • setNameX

        public void setNameX(String s)
        Sets the name for X axis. Should be called before setChart* methods.
        Parameters:
        s - Title for X axis.
      • setNameY

        public void setNameY(String s)
        Sets the name for Y axis. Should be called before setChart* methods.
        Parameters:
        s - Title for Y axis.
      • setLogScale

        public void setLogScale(int axis,               boolean b)
        Sets true or false to plot on a log scale.
        Parameters:
        axis - defines to which axis this function applies, generally something like X_AXIS or Y_AXIS.
        b - toggle, true if the scaling is logarithmic
      • setAxis

        public void setAxis(int axis,           ValueAxis a)
        Sets axis
        Parameters:
        axis - defines to which axis this function applies. 0 means X aaxis, 1 means Y axis.
        a - axis object
      • getAxis

        public ValueAxis getAxis(int axis)
        Get the axis
        Parameters:
        axis - defines to which axis this function applies. 0 means X aaxis, 1 means Y axis.
      • setFontLegent

        public void setFontLegent(Font f)
        Set font for legend title
        Parameters:
        f -
      • setFontTitle

        public void setFontTitle(Font f)
        Set font for legend title
        Parameters:
        f -
      • draw

        public void draw(double[] x,        double[] y)
        Draw X-Y data from arrays
        Parameters:
        x - X values
        y - Y values
      • draw

        public void draw(F1D f1)
        Draw a F1D function on the canvas. For several functions, consider the add() method.
        Parameters:
        f1d - F1D function
      • draw

        public void draw(H1D f1)
        Draw a H1D histogram on the canvas. For several histograms, consider the add() method.
        Parameters:
        f1d - H1D histograms
      • add

        public void add(F1D f1)
        Add a F1D function to the canvas. Call update() to draw all functions. Use the methods setColor() etc. of F1D function to change the style
        Parameters:
        f1d - F1D function
      • add

        public void add(H1D h1)
        Add a H1D histogram to the chart. Call update() method to view it.
        Parameters:
        h1 - H1D histogram
      • setLegendPosition

        public void setLegendPosition(org.jfree.ui.RectangleEdge e)
        Legend position
        Parameters:
        e -
      • setLegend

        public void setLegend(boolean b)
        Sets whether or not this line style should draw the name in the legend of the graph.
        Parameters:
        b - true if the name should be shown
      • add

        public void add(P1D d)
        Draw data from a P1D. Drawing updated automatically. 1st level errors are shown if the dimension is above 5. Otherwise show X and Y. If you set setChartPolar() before,m you can also show polar coordinates.
        Parameters:
        d - input P1D container
      • valuePie

        public void valuePie(String name,            double value)
        Set a value to pie data set
        Parameters:
        name - Name for this number
        value - Number
      • valuePie3D

        public void valuePie3D(String name,              double value)
        Set a value to 3D pie data set. You should call update() method to display it
        Parameters:
        name - Name for this number
        value - Number
      • valueBar

        public void valueBar(double value,            String series,            String category)
        Set a value to a Bar chart. You should call update() method to display it
        Parameters:
        value - Value
        series - Series
        category - category
      • valueArea

        public void valueArea(double value,             String series,             String category)
        Set a value to a area chart. You should call update() method to display it
        Parameters:
        value - Value
        series - Series
        category - category
      • setRange

        public void setRange(int axis,            double min,            double max)
        Sets the range (min-max) displayed on the axis.
        Parameters:
        axis - defines to which axis this function applies, generally something like X_AXIS or Y_AXIS.
        min - minimum value on the axis
        max - maximum value on the axis
      • setAutoRange

        public void setAutoRange(boolean b)
        Set auto-range in X and Y at the same time
        Parameters:
        b - if true, sets auto-range
      • setAutoRange

        public void setAutoRange()
        Set autorange in X and Y at the same time
      • setAntiAlias

        public void setAntiAlias(boolean setit)
        Set antialiasing for the graphics of the current plot
        Parameters:
        setit - true if antialiasing is set
      • getAntiAlias

        public boolean getAntiAlias()
        Get antialiasing for the graphics of the current plot
        Returns:
        true if antialiasing is set
      • setGrid

        public void setGrid(boolean b)
        Sets whether or not using grid lines. Grid lines are lines drawn from tick to tick. They can be enabled/disabled per axis.
        Parameters:
        b - true if shown
      • setGrid

        public void setGrid(int axis,           boolean b)
        Sets whether or not using grid lines. Grid lines are lines drawn from tick to tick. They can be enabled/disabled per axis.
        Parameters:
        axis - defines to which axis this function applies. 0 means X axis, y means y axis
        b - toggle, true if the the grid should be drawn.
      • setGridColor

        public void setGridColor(Color c)
        Sets color of the grid lines for all plots on the same canvas
        Parameters:
        c - Color
      • setGridPenWidth

        public void setGridPenWidth(double width)
        Sets width of the line for the grid
        Parameters:
        c - width of the line
      • setGridPenWidth

        public void setGridPenWidth(int axis,                   double width)
        Sets the width of the line for grid
        Parameters:
        axis - 0 is X axcis, 1 is Y axis
        width - with of the line
      • setBackgColor

        public void setBackgColor(Color color)
        Sets the actual background color of the entire graph panel. Note that it is possible to set the color of the area within the axes system separately.
        Parameters:
        color - New background color.
      • valueLine

        public void valueLine(double value,             String series,             String category)
        Set a value to a Line chart. You should call update() method to display it
        Parameters:
        value - Value
        series - Series
        category - category
      • valueBar3D

        public void valueBar3D(double value,              String series,              String category)
        Set a value to a 3D Bar chart. You should call update() method to display it
        Parameters:
        value - Value
        series - Series
        category - category
      • update

        public void update(int N1,          int N2)
        Update the chart
        Parameters:
        N1 - location in X
        N2 - location in Y
      • getChart

        public JFreeChart getChart()
        Returns current Chart
        Returns:
        current chart
      • getAxisX

        public Axis getAxisX()
        Get X-axis
      • getAxisY

        public Axis getAxisY()
        Get Y-axis
      • getPlot

        public XYPlot getPlot()
        Get XY plot
      • getChartPanel

        public ChartPanel getChartPanel()
        Returns current Chart panel
        Returns:
        current Chart panel
      • close

        public void close()
        Close the canvas (and dispose all components) Note: a memory leak is found - no time to investigate it. set to null all the stuff
      • quit

        public void quit()
        Quit the frame
      • doc

        public void doc()
        Show online documentation.
      • drawToGraphics2D

        public void drawToGraphics2D(Graphics2D g,                    int width,                    int height)
      • export

        public void export(String filename)
        Export graph into an image file. The the image format is given by extension. "png", "jpg", "eps", "pdf", "svg". In case of "eps", "pdf" and "svg", vector graphics is used.
        Overrides:
        export in class GHPanel
        Parameters:
        file - name of the image
      • export

        public void export(String filename,          int width,          int height)
        Export graph into an image file. The the image format is given by extension. "png", "jpg", "eps", "pdf", "svg". In case of "eps", "pdf" and "svg", vector graphics is used.
        Parameters:
        filename - file name
        width - width
        height - hight

SCaVis 2.2 © jWork.ORG