com.dukascopy.api
Interface IChart

All Superinterfaces:
Iterable<IChartObject>

public interface IChart
extends Iterable<IChartObject>

Allows to draw graphical objects on the chart


Nested Class Summary
static class IChart.Type
          Type of the graphical object
 
Method Summary
 void addIndicator(IIndicator indicator)
          Add indicator to the chart
 void addIndicator(IIndicator indicator, Object[] optParams)
          Add indicator to the chart by specifying initial optional parameters values If optParams equals to null - default ones will be taken instead
 void addIndicator(IIndicator indicator, Object[] optParams, Color[] outputColors, OutputParameterInfo.DrawingStyle[] outputDrawingStyles, int[] outputWidths)
          Add indicator to the chart by specifying initial optional parameters values, curves colors, drawing styles and line widths If output params are nulls - default ones will be taken instead
 void addSubIndicator(Integer subChartId, IIndicator indicator)
          Add sub indicator
<T extends IChartObject>
void
addToMainChart(T object)
          Adds object of IChartObject super type to main chart window.
<T extends IChartObject>
void
addToMainChartUnlocked(T object)
          Adds object of IChartObject super type to unlocked objects pool of main chart window.
<T extends IChartObject>
void
addToSubChart(Integer subChartId, int indicatorId, T object)
          Adds object of IChartObject super type to sub chart window with specified subChartId and indicatorId.
 void comment(String comment)
          Writes a comment in the upper left corner.
 IChartObject draw(String key, IChart.Type type, long time1, double price1)
          Deprecated. - this method is deprecated. please use IChartObjectFactory create() method() instead.
 IChartObject draw(String key, IChart.Type type, long time1, double price1, long time2, double price2)
          Deprecated. - this method is deprecated. please use IChartObjectFactory create() method() instead.
 IChartObject draw(String key, IChart.Type type, long time1, double price1, long time2, double price2, long time3, double price3)
          Deprecated. - this method is deprecated. please use IChartObjectFactory create() method() instead.
 IChartObject drawUnlocked(String key, IChart.Type type, long time1, double price1)
          Deprecated. - this method is deprecated. please use addToMainChartUnlocked() method instead.
 IChartObject drawUnlocked(String key, IChart.Type type, long time1, double price1, long time2, double price2)
          Deprecated. - this method is deprecated. please use addToMainChartUnlocked() method instead. Draws graphical object that requires up to 2 points. Object can be selected, moved and changed by the user
 IChartObject drawUnlocked(String key, IChart.Type type, long time1, double price1, long time2, double price2, long time3, double price3)
          Deprecated. - this method is deprecated. please use addToMainChartUnlocked() method instead. Draws graphical object that requires up to 3 points. Object can be selected, moved and changed by the user
 IChartObject get(String key)
          Returns graphical object by key
 List<IChartObject> getAll()
          Returns all graphical objects
 int getBarsCount()
          Returns amount of bars visible on the screen
 IChartObjectFactory getChartObjectFactory()
          Returns IChartObjectFactory instance.
 Color getCommentColor()
          Gets the foreground color of comment.
 Font getCommentFont()
          Gets the comment's font.
 int getCommentHorizontalPosition()
          Returns the horizontal position of the comment's text.
 int getCommentVerticalPosition()
          Returns the vertical position of the comment's text.
 DataType getDataType()
          Returns selected Data Type
 List<IIndicator> getIndicators()
          Return all chart's indicators
 Instrument getInstrument()
          Returns instrument of the chart
 PriceRange getPriceRange()
          The method returns currently selected Price Range on chart
 ReversalAmount getReversalAmount()
          The method returns currently selected Reversal Amount on the Point And Figure chart For non P&F charts null will be returned
 OfferSide getSelectedOfferSide()
          Returns selected offer side
 Period getSelectedPeriod()
          Returns selected period
 TickBarSize getTickBarSize()
          The method returns currently selected Trade Bar Size on Tick Bar chart For non Tick Bar charts null might be returned
 void move(IChartObject objectToMove, long newTime, double newPrice)
          Moves graphical object to new coordinates.
 void move(String chartObjectKey, long newTime, double newPrice)
          Moves graphical object to new coordinates.
 double priceMax(int index)
          Returns maximal value of the vertical scale of the specified subwindow of the current chart (0-main chart window, the indicators' subwindows are numbered starting from 1).
 double priceMin(int index)
          Returns minimal value of the vertical scale of the specified subwindow of the current chart (0-main chart window, the indicators' subwindows are numbered starting from 1).
 void remove(IChartObject chartObject)
          Deletes graphical object
 IChartObject remove(String key)
          Deletes and returns graphical object by key
 void removeAll()
          Removes all graphical objects on the chart
 void removeIndicator(IIndicator indicator)
          Remove specified indicator from the chart
 void repaint()
          Refresh and repaint chart
 void setCommentColor(Color color)
          Sets the foreground color of comment.
 void setCommentFont(Font font)
          Sets the comment's font.
 void setCommentHorizontalPosition(int position)
          Sets the horizontal position of the comment's text.
 void setCommentVerticalPosition(int position)
          Sets the vertical position of the comment's text.
 void setInstrument(Instrument instrument)
          Sets chart's instrument
 int size()
          Returns number of the graphical objects on the chart
 int windowsTotal()
          Returns count of indicator windows on the chart (including main chart).
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

draw

@Deprecated
IChartObject draw(String key,
                             IChart.Type type,
                             long time1,
                             double price1,
                             long time2,
                             double price2,
                             long time3,
                             double price3)
Deprecated. - this method is deprecated. please use IChartObjectFactory create() method() instead.

Draws graphical object that requires up to 3 points

Parameters:
key - unique id of the object
type - type of the object
time1 - time of first point
price1 - price of first point
time2 - time of second point
price2 - price of second point
time3 - time of third point
price3 - price of third point
Returns:
graphical object

draw

@Deprecated
IChartObject draw(String key,
                             IChart.Type type,
                             long time1,
                             double price1,
                             long time2,
                             double price2)
Deprecated. - this method is deprecated. please use IChartObjectFactory create() method() instead.

Draws graphical object that requires up to 2 points

Parameters:
key - unique id of the object
type - type of the object
time1 - time of first point
price1 - price of first point
time2 - time of second point
price2 - price of second point
Returns:
graphical object

draw

@Deprecated
IChartObject draw(String key,
                             IChart.Type type,
                             long time1,
                             double price1)
Deprecated. - this method is deprecated. please use IChartObjectFactory create() method() instead.

Draws graphical object that requires only 1 point

Parameters:
key - unique id of the object
type - type of the object
time1 - time of the point
price1 - price of the point
Returns:
graphical object

drawUnlocked

@Deprecated
IChartObject drawUnlocked(String key,
                                     IChart.Type type,
                                     long time1,
                                     double price1,
                                     long time2,
                                     double price2,
                                     long time3,
                                     double price3)
Deprecated. - this method is deprecated. please use addToMainChartUnlocked() method instead. Draws graphical object that requires up to 3 points. Object can be selected, moved and changed by the user

Parameters:
key - unique id of the object
type - type of the object
time1 - time of first point
price1 - price of first point
time2 - time of second point
price2 - price of second point
time3 - time of third point
price3 - price of third point
Returns:
graphical object

drawUnlocked

@Deprecated
IChartObject drawUnlocked(String key,
                                     IChart.Type type,
                                     long time1,
                                     double price1,
                                     long time2,
                                     double price2)
Deprecated. - this method is deprecated. please use addToMainChartUnlocked() method instead. Draws graphical object that requires up to 2 points. Object can be selected, moved and changed by the user

Parameters:
key - unique id of the object
type - type of the object
time1 - time of first point
price1 - price of first point
time2 - time of second point
price2 - price of second point
Returns:
graphical object

drawUnlocked

@Deprecated
IChartObject drawUnlocked(String key,
                                     IChart.Type type,
                                     long time1,
                                     double price1)
Deprecated. - this method is deprecated. please use addToMainChartUnlocked() method instead.

Draws graphical object that requires only 1 point. Object can be selected, moved and changed by the user

Parameters:
key - unique id of the object
type - type of the object
time1 - time of the point
price1 - price of the point
Returns:
graphical object

move

void move(IChartObject objectToMove,
          long newTime,
          double newPrice)
Moves graphical object to new coordinates. Do not initiate chart repaint immediately, use IChart.repaint() method if necessary.

Parameters:
objectToMove - chart object to move
newTime - new time coordinate
newPrice - new price coordinate

move

void move(String chartObjectKey,
          long newTime,
          double newPrice)
Moves graphical object to new coordinates. Do not initiate chart repaint immediately, use IChart.repaint() method if necessary.

Parameters:
chartObjectKey - key of the chart object to move
newTime - new time coordinate
newPrice - new price coordinate

comment

void comment(String comment)
Writes a comment in the upper left corner. Line is splitted by new line characters

Parameters:
comment - string to display

setCommentHorizontalPosition

void setCommentHorizontalPosition(int position)
Sets the horizontal position of the comment's text.

Parameters:
position - One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT
Throws:
IllegalArgumentException
See Also:
#getCommentHorizontalPosition()}, java.swing.SwingConstants

getCommentHorizontalPosition

int getCommentHorizontalPosition()
Returns the horizontal position of the comment's text.

Returns:
One of the following constants defined in SwingConstants: LEFT, CENTER, RIGHT.
See Also:
setCommentHorizontalPosition(int)

setCommentVerticalPosition

void setCommentVerticalPosition(int position)
Sets the vertical position of the comment's text.

Parameters:
position - One of the following constants defined in SwingConstants: TOP, CENTER, BOTTM
Throws:
IllegalArgumentException
See Also:
getCommentVerticalPosition(), SwingConstants

getCommentVerticalPosition

int getCommentVerticalPosition()
Returns the vertical position of the comment's text.

Returns:
One of the following constants defined in SwingConstants: TOP, CENTER, BOTTOM.
See Also:
setCommentVerticalPosition(int)

setCommentFont

void setCommentFont(Font font)
Sets the comment's font.

Parameters:
font - the desired Font for comment
See Also:
Component.getFont()

getCommentFont

Font getCommentFont()
Gets the comment's font.

Returns:
comment's font; if a font has not been set for comment, then the font defined in chart's theme for drawings is returned
See Also:
setCommentFont(Font)

setCommentColor

void setCommentColor(Color color)
Sets the foreground color of comment.

Parameters:
color - the color to become comment's foreground color if this parameter is null, then used default text font defined in chart's theme
See Also:
getCommentColor()

getCommentColor

Color getCommentColor()
Gets the foreground color of comment.

Returns:
comments's foreground color if comment does not have a foreground color, then used default text font defined in chart's theme
See Also:
setCommentColor(Color)

get

IChartObject get(String key)
Returns graphical object by key

Parameters:
key - unique id of the object
Returns:
graphical object or null if no object was found by specified key

remove

IChartObject remove(String key)
Deletes and returns graphical object by key

Parameters:
key - unique id of the object
Returns:
graphical object that was deleted or null if no object was found by specified key

remove

void remove(IChartObject chartObject)
Deletes graphical object

Parameters:
chartObject -

getAll

List<IChartObject> getAll()
Returns all graphical objects

Returns:
list of all graphical objects on the chart

removeAll

void removeAll()
Removes all graphical objects on the chart


size

int size()
Returns number of the graphical objects on the chart

Returns:
number of the graphical objects on the chart

priceMin

double priceMin(int index)
Returns minimal value of the vertical scale of the specified subwindow of the current chart (0-main chart window, the indicators' subwindows are numbered starting from 1). If the subwindow index has not been specified, the minimal value of the price scale of the main chart window is returned.

Parameters:
index - of the (sub-)window
Returns:
minimal value of the vertical scale

priceMax

double priceMax(int index)
Returns maximal value of the vertical scale of the specified subwindow of the current chart (0-main chart window, the indicators' subwindows are numbered starting from 1). If the subwindow index has not been specified, the maximal value of the price scale of the main chart window is returned.

Parameters:
index - of the (sub-)window
Returns:
maximal value of the vertical scale

getBarsCount

int getBarsCount()
Returns amount of bars visible on the screen

Returns:
amount of bars visible on the screen

windowsTotal

int windowsTotal()
Returns count of indicator windows on the chart (including main chart).

Returns:
total count of chart windows (main window + indicator subwindows)

getInstrument

Instrument getInstrument()
Returns instrument of the chart

Returns:
instrument of the chart

setInstrument

void setInstrument(Instrument instrument)
Sets chart's instrument

Parameters:
instrument -

getSelectedPeriod

Period getSelectedPeriod()
Returns selected period

Returns:
selected period

getSelectedOfferSide

OfferSide getSelectedOfferSide()
Returns selected offer side

Returns:
selected offer side

addIndicator

void addIndicator(IIndicator indicator)
Add indicator to the chart

Parameters:
indicator - as IIndicator

addIndicator

void addIndicator(IIndicator indicator,
                  Object[] optParams)
Add indicator to the chart by specifying initial optional parameters values If optParams equals to null - default ones will be taken instead

Parameters:
indicator - as IIndicator
optParams - as Object[]

addIndicator

void addIndicator(IIndicator indicator,
                  Object[] optParams,
                  Color[] outputColors,
                  OutputParameterInfo.DrawingStyle[] outputDrawingStyles,
                  int[] outputWidths)
Add indicator to the chart by specifying initial optional parameters values, curves colors, drawing styles and line widths If output params are nulls - default ones will be taken instead

Parameters:
indicator - as IIndicator
optParams - as Object[]
outputColors - as Color[]
outputDrawingStyles - as DrawingStyle[]
outputWidths - as int[]

addSubIndicator

void addSubIndicator(Integer subChartId,
                     IIndicator indicator)
Add sub indicator

Parameters:
subChartId -
indicator - as IIndicator

removeIndicator

void removeIndicator(IIndicator indicator)
Remove specified indicator from the chart

Parameters:
indicator - as IIndicator

getIndicators

List<IIndicator> getIndicators()
Return all chart's indicators

Returns:
List

getDataType

DataType getDataType()
Returns selected Data Type

Returns:
selected Data Type

getPriceRange

PriceRange getPriceRange()
The method returns currently selected Price Range on chart

Returns:
selected Price Range

getReversalAmount

ReversalAmount getReversalAmount()
The method returns currently selected Reversal Amount on the Point And Figure chart For non P&F charts null will be returned

Returns:
selected Reversal Amount

repaint

void repaint()
Refresh and repaint chart


getChartObjectFactory

IChartObjectFactory getChartObjectFactory()
Returns IChartObjectFactory instance. This factory provides convenience methods to create various graphics objects.

Returns:
IChartObjectFactory instance.

addToMainChart

<T extends IChartObject> void addToMainChart(T object)
Adds object of IChartObject super type to main chart window. Please note that only 1 instance of object can be added per main chart window.

Parameters:
object - - instance of IChartObject super type.
Throws:
IllegalArgumentException - - if object is already present on any of main charts.

addToSubChart

<T extends IChartObject> void addToSubChart(Integer subChartId,
                                            int indicatorId,
                                            T object)
Adds object of IChartObject super type to sub chart window with specified subChartId and indicatorId. Please note that only 1 instance of object can be added per sub chart window.

Parameters:
subChartId - - sub chart id.
indicatorId - - indicator function id.
object - - instance of IChartObject super type.
Throws:
IllegalArgumentException - - if object is already present on any of sub charts.

addToMainChartUnlocked

<T extends IChartObject> void addToMainChartUnlocked(T object)
Adds object of IChartObject super type to unlocked objects pool of main chart window. Please note that only 1 instance of object can be added to unlocked objects pool per main chart window.

Parameters:
object - - instance of IChartObject super type.
Throws:
IllegalArgumentException - - if object is already present on any of main charts unlocked objects pool.

getTickBarSize

TickBarSize getTickBarSize()
The method returns currently selected Trade Bar Size on Tick Bar chart For non Tick Bar charts null might be returned

Returns:
selected Tick Bar Size


Copyright © 2011. All Rights Reserved.