Dukascopy
 
 
Wiki JStore Search Login

Numerous bugs in implementation of IScreenLabelChartObject
 Post subject: Numerous bugs in implementation of IScreenLabelChartObject Post rating: 0   New post Posted: Fri 10 Nov, 2017, 17:46 

User rating: 18
Joined: Thu 20 Apr, 2017, 22:42
Posts: 165
Location: Russian Federation,
Hello, I tried playing with a new IScreenLabelChartObject introduced in 3.2.19/API 2.13.43. It seems there is no way to make it work via public API.

My observations are:
1. Invocation of IScreenLabelChartObject.setColor() before setText() causes NullPointerException
2. Invocation of IScreenLabelChartObject.setColor() after setText() - resets text to empty string - ""
3. setText() after setColor() does not make text to show up in actual label - it is empty, however text is correctly displayed in Navigator tree. Right Click (on label in Navigator) -> "Edit Label" shows up "Edit Text" dialog with empty editor.

Below is dummy plugin to reproduce the problem:
package jforex;

import com.dukascopy.api.IChart;
import com.dukascopy.api.JFException;
import com.dukascopy.api.drawings.IChartObjectFactory;
import com.dukascopy.api.drawings.IScreenLabelChartObject;
import com.dukascopy.api.plugins.IPluginContext;
import com.dukascopy.api.plugins.Plugin;

import java.awt.*;
import java.io.PrintStream;

public class MyUiTestPlugin extends Plugin {

    @Override
    public void onStart(IPluginContext context) throws JFException {
        IChart chart = context.getLastActiveChart();
        IChartObjectFactory cof = chart.getChartObjectFactory();
        Font boldFont = new Font("Arial", Font.BOLD, 11);
        PrintStream info = context.getConsole().getInfo();

        chart.remove("top-left-key");
        chart.remove("top-right-key");

        try {
            IScreenLabelChartObject label = cof.createScreenLabel("top-left-key");
            label.setCorner(IScreenLabelChartObject.Corner.TOP_LEFT);
            label.setxDistance(10);
            label.setyDistance(10);
            label.setText("top-left-text", boldFont);
            info.println("text 1: " + label.getText());

            label.setColor(Color.RED);
            info.println("text 2: " + label.getText());

            label.setText("top-left-text");
            info.println("text 3: " + label.getText());
            chart.add(label);
        }
        catch( Exception e ) {
            e.printStackTrace(context.getConsole().getErr());
        }

        try {
            IScreenLabelChartObject label = cof.createScreenLabel("top-right-key");
            label.setCorner(IScreenLabelChartObject.Corner.TOP_RIGHT);
            label.setxDistance(10);
            label.setyDistance(10);
            label.setColor(Color.RED);
            label.setText("top-right-text", boldFont);
            chart.add(label);
        }
        catch( Exception e ) {
            e.printStackTrace(context.getConsole().getErr());
        }
    }

    @Override
    public void onStop() throws JFException {
    }
}


 
 Post subject: Re: Numerous bugs in implementation of IScreenLabelChartObject Post rating: 0   New post Posted: Thu 30 Nov, 2017, 18:13 

User rating: 1
Joined: Tue 12 Jul, 2011, 20:43
Posts: 51
Location: Germany,
Hello support,

when this bug will be fixed ?

I have a similar problem. Since last update an IScreenLabelChartObject instance created in a custom indicator (displays counted ticks of current bar in a tickbar chart) is no longer visible on chart.

If necessary please move this topic to:
Dukascopy Support Board -> Automated Trading -> Bug Reports

Thanks and regards
AbsoluteReturner


 

Jump to:  

  © 1998-2024 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