Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

IChart in a Standalone software
 Post subject: IChart in a Standalone software Post rating: 0   New post Posted: Tue 19 Mar, 2013, 17:12 

User rating: 0
Joined: Wed 18 May, 2011, 21:14
Posts: 4
Location: Switzerland, Biel
Hi support,

After a successful connection I would like to insert a JPanel with a graph on my basis JFrame

I use this code :

private void startStrategy() throws Exception {

final int frameWidth = 1000;
final int frameHeight = 600;
final int controlPanelHeight = 50;

// subscribe to the instruments
final Instrument[] instrArr = new Instrument[] { EURUSD };

Set<Instrument> instruments = new HashSet<Instrument>(Arrays.asList(instrArr));

logger.info("Subscribing instruments...");
client.setSubscribedInstruments(instruments);

logger.info("Start strategy...");
client.startStrategy(new StrategyPublicMethods());

logger.info("Open chart...");
IFeedDescriptor feedDescriptor = new FeedDescriptor();
feedDescriptor.setDataType(DataType.TICKS);
feedDescriptor.setInstrument(Instrument.EURUSD);
IChart chart = client.openChart(feedDescriptor);

final IClientGUI clientGUI = client.getClientGUI(chart);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
clientGUI.getChartPanel().setPreferredSize(new Dimension(frameWidth, frameHeight - controlPanelHeight));
clientGUI.getChartPanel().setMinimumSize(new Dimension(frameWidth, 200));
clientGUI.getChartPanel().setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE));
getContentPane().add(clientGUI.getChartPanel());

addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
client.closeChart(clientGUI.getChart());
}
});
}
});
}

The graph does not appear. What is the problem?

Thanks

Sacha


 
 Post subject: Re: IChart in a Standalone software Post rating: 0   New post Posted: Tue 19 Mar, 2013, 18:48 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
Consider starting from the following example program and integrate your logic into it:
https://www.dukascopy.com/wiki/#JForex_SDK/Open_a_chart_from_IClient


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com