public class Graph2D extends Object
修飾子とタイプ | クラスと説明 |
---|---|
protected class |
Graph2D.Label
グラフ上に描画するラベルの情報を保持します。
|
コンストラクタと説明 |
---|
Graph2D()
グラフを構築します。
|
Graph2D(double xMin,
double xMax,
double yMin,
double yMax)
X軸・Y軸の範囲を指定してグラフを構築します。
|
Graph2D(Object xMin,
Object xMax,
Object yMin,
Object yMax)
X軸・Y軸の範囲を指定して、グラフを構築します。
|
修飾子とタイプ | メソッドと説明 |
---|---|
void |
addLabel(double x,
double y,
String msg)
グラフにラベルを追加します。
|
void |
addLabel(double x,
double y,
String msg,
Color fg,
Color bg,
Font font)
グラフにラベルを追加します。
|
void |
addLabel(Object x,
Object y,
String msg)
グラフにラベルを追加します。
|
void |
addLabel(Object x,
Object y,
String msg,
Color fg,
Color bg,
Font font)
グラフにラベルを追加します。
|
int |
addSeries(GraphSeries dat)
グラフに系列を追加します。
|
void |
drawGraph(Graphics2D gr,
Rectangle rect)
グラフを描画します。
|
protected void |
drawLabel(Graphics2D gr,
Rectangle rect)
グラフ上に設定されたラベルを描画します。
|
protected void |
drawTitle(Graphics2D gr,
Rectangle rect)
グラフのタイトルを描画します。
|
Font |
getFont()
グラフで現在使用しているフォントを返します。
|
BufferedImage |
getImage(int nWidth,
int nHeight)
グラフのイメージを取得します。
|
BufferedImage |
getImage(int nWidth,
int nHeight,
Rectangle rect)
グラフのイメージを取得します。
|
BufferedImage |
getImage(int nWidth,
int nHeight,
Rectangle rect,
int imgType)
グラフのイメージを取得します。
|
String |
getTitle()
グラフのタイトルを返します。
|
Font |
getTitleFont()
タイトルに使用するフォントを返します。
|
GraphScale |
getXScale()
X軸の目盛りを取得します。
|
GraphScale |
getYScale()
Y軸の目盛りを取得します。
|
void |
setBackground(Color col)
グラフの背景色を設定します。
|
void |
setBgImage(Image img)
背景の画像を設定します。
|
void |
setColor(Color col)
グラフの文字色を設定します。
|
void |
setFont(Font font)
グラフで使用するフォントを設定します。
|
void |
setImage(BufferedImage img)
書き込みを行うイメージを設定します。
|
void |
setRenderingHint(RenderingHints.Key hintKey,
Object hintValue)
描画アルゴリズムの推奨設定の値を 1 つ設定します。
|
void |
setTitle(String title)
グラフのタイトルを設定します。
|
void |
setTitleFont(Font font)
タイトルに使用するフォントを設定します。
|
void |
setTitlePosition(int nPos)
タイトルの位置を設定します。
|
void |
setXScale(double min,
double max)
目盛りの範囲を指定してX軸の目盛りを構築します。
|
void |
setXScale(GraphScale sc)
X軸の目盛りを指定します。
|
void |
setXScaleHeight(int nHeight)
X軸目盛りの高さを設定します。
|
void |
setYScale(double min,
double max)
目盛りの範囲を指定してY軸の目盛りを構築します。
|
void |
setYScale(GraphScale sc)
Y軸の目盛りを指定します。
|
void |
setYScaleWidth(int nWidth)
Y軸目盛りの幅を設定します。
|
public Graph2D()
public Graph2D(double xMin, double xMax, double yMin, double yMax)
xMin
- X軸の最小値xMax
- X軸の最大値yMin
- Y軸の最小値yMax
- Y軸の最大値public int addSeries(GraphSeries dat)
dat
- 追加する系列public void setXScale(double min, double max)
min
- X軸の最小値max
- X軸の最大値public void setXScale(GraphScale sc)
sc
- 目盛り。無い場合はnull。public void setYScale(double min, double max)
min
- Y軸の最小値max
- Y軸の最大値public void setYScale(GraphScale sc)
sc
- 目盛り。無い場合はnull。public GraphScale getXScale()
public GraphScale getYScale()
public void setXScaleHeight(int nHeight)
nHeight
- X軸目盛りの高さ。getImage(int,int)
public void setYScaleWidth(int nWidth)
nWidth
- Y軸目盛りの幅。getImage(int,int)
public void setFont(Font font)
font
- 設定するフォント。public Font getFont()
public void setColor(Color col)
col
- 設定する背景色。public void setBackground(Color col)
col
- 設定する背景色。public void setRenderingHint(RenderingHints.Key hintKey, Object hintValue)
hintKey
- 設定されるヒントのキーhintValue
- 指定されたヒントカテゴリの推奨設定を示す値public void setImage(BufferedImage img)
img
- イメージpublic void setTitle(String title)
title
- 設定するタイトル。public String getTitle()
public void setTitleFont(Font font)
font
- 設定するフォント。public Font getTitleFont()
public void setTitlePosition(int nPos)
public void setBgImage(Image img)
img
- 背景の画像public void addLabel(double x, double y, String msg)
x
- ラベルのX座標の値y
- ラベルのY座標の値msg
- ラベルの文字列public void addLabel(Object x, Object y, String msg)
x
- ラベルのX座標の値y
- ラベルのY座標の値msg
- ラベルの文字列public void addLabel(Object x, Object y, String msg, Color fg, Color bg, Font font)
x
- ラベルのX座標の値y
- ラベルのY座標の値msg
- ラベルの文字列fg
- 文字色bg
- 背景色font
- フォントpublic void addLabel(double x, double y, String msg, Color fg, Color bg, Font font)
x
- ラベルのX座標の値y
- ラベルのY座標の値msg
- ラベルの文字列fg
- 文字色bg
- 背景色font
- フォントprotected void drawLabel(Graphics2D gr, Rectangle rect)
gr
- 出力先rect
- イメージ中のグラフの領域protected void drawTitle(Graphics2D gr, Rectangle rect)
gr
- 出力先rect
- イメージ中のグラフの領域public BufferedImage getImage(int nWidth, int nHeight)
setXScaleHeight(int)
,
setYScaleWidth(int)
で指定された目盛りの幅を差し引いてグラフ本体を
出力します。nWidth
- 出力するイメージの幅。nHeight
- 出力するイメージの高さ。setXScaleHeight(int)
,
setYScaleWidth(int)
public BufferedImage getImage(int nWidth, int nHeight, Rectangle rect)
Rectangle
で指定された大きさになり
目盛りはグラフ本体の外に描画されます。
このメソッドで出力されるイメージはBufferedImage.TYPE_BYTE_BINARY
になります。nWidth
- 出力するイメージの幅。nHeight
- 出力するイメージの高さ。rect
- 出力するグラフ領域の境界の矩形。public BufferedImage getImage(int nWidth, int nHeight, Rectangle rect, int imgType)
setImage(BufferedImage)
により別イメージが設定されている場合には
幅と高さの指定は無視されます。
作成されるグラフ本体の大きさはRectangle
で指定された大きさになり
目盛りはグラフ本体の外に描画されます。nWidth
- 出力するイメージの幅。nHeight
- 出力するイメージの高さ。rect
- 出力するグラフ領域の境界の矩形。imgType
- 出力するイメージのタイプ。
BufferedImage
の定義済みイメージタイプを参照して
ください。public void drawGraph(Graphics2D gr, Rectangle rect)
gr
- 出力先rect
- イメージ中のグラフの領域Copyright © 2021 S.D.S Co.,Ltd.. All rights reserved.