Dukascopy
 
 
Wiki JStore Search Login

Strategy Adds Graphic Objects, Workspace Chart Tree View is expanded
 Post subject: Strategy Adds Graphic Objects, Workspace Chart Tree View is expanded Post rating: 0   New post Posted: Tue 18 Dec, 2012, 18:33 
User avatar

User rating: 98
Joined: Mon 23 Jul, 2012, 02:02
Posts: 656
Location: United States, Durham, NC
JForex platform LIVE FXDD ver. 2.21.11 JForex API ver. 2.7.5.2

This is a behavior which has existed for many months; I just haven't reported it; NOT a new behavior.

Attached screenshot shows that the Tree View of the Chart is forced to expand. If I collapse it, then it continues to expand itself. I would like the tree view to close, and not to auto-expand.

A Strategy module is placing the horizontal and vertical line objects on the chart, and this appears to have the side-effect of causing the Chart's Workspace Tree View to auto-expand, even if I collapse it, it immediately reverts to expanded for the chart marked on the screenshot.

The Strategy module code does delete and replace charting objects, and here is a small section of the code (not necessarily elegant code...). The code does "remove" the object and then add it again, which I realize is not necessarily most efficient :

        // draw a label
        final ILabelChartObject myDrawLabel(final IChart chart,final String key, IChart.Type type, long time, double price) {
            IChartObject existing = chart.get(key);
            if (existing!=null) {
                chart.remove(existing); // otherwise, they accumulate?
            }
            IChartObjectFactory factory = chart.getChartObjectFactory();
            ILabelChartObject co = factory.createLabel(key, time, price);
            //IChartObject co = chart.draw(key, IChart.Type.LABEL, time, price);
            return co;
        }
       
        // draw a horizontal line
        final IHorizontalLineChartObject myDrawHorizontalLine(final IChart chart,final String key, IChart.Type type, long time, double price) {
            IChartObject existing = chart.get(key);
            if (existing!=null) {
                chart.remove(existing); // otherwise, they accumulate?
            }
            IChartObjectFactory factory = chart.getChartObjectFactory();
            IHorizontalLineChartObject co = factory.createHorizontalLine(key, price);
            return co;
        }
       
       
        // draw a dashed horizontal line
        final IHorizontalLineChartObject myDrawDashedHorizontalLine(final IChart chart,final String key, IChart.Type type, long time, double price) {
            IChartObject existing = chart.get(key);
            if (existing!=null) {
                chart.remove(existing); // otherwise, they accumulate?
            }
            IChartObjectFactory factory = chart.getChartObjectFactory();
            IHorizontalLineChartObject co = factory.createHorizontalLine(key, price);
            co.setStroke(dashedStroke);
            return co;
        }
       
/// ................. example of calling these routines from within onTick handler

                    // up 1
                    chartObject = myDrawLabel(chart,"PipsUp1", IChart.Type.LABEL, nowTime + timeInterval, tickRef+pipValue);
                    chartObject.setColor(Color.yellow);
                    chartObject.setText("+1 ___", new Font(Font.SANS_SERIF, Font.PLAIN, 14));
                    chart.addToMainChart(chartObject);
                    if (useLines) {
                    chartObject = myDrawDashedHorizontalLine(chart,"PipsUp1Line", IChart.Type.HLINE, nowTime, tickRef+pipValue);
                    chartObject.setColor(Color.GRAY);
                    chart.addToMainChart(chartObject);
                    }
                   

                    // up 2
                    chartObject = myDrawLabel(chart,"PipsUp2", IChart.Type.LABEL, nowTime + timeInterval, tickRef+2.0*pipValue);
                    chartObject.setColor(Color.yellow);
                    chartObject.setText("+2 ___", new Font(Font.SANS_SERIF, Font.PLAIN, 14));
                    chart.addToMainChart(chartObject);
                    if (useLines) {
                    chartObject = myDrawDashedHorizontalLine(chart,"PipsUp2Line", IChart.Type.HLINE, nowTime, tickRef+2.0*pipValue);
                    chartObject.setColor(Color.GRAY);
                    chart.addToMainChart(chartObject);
                    }




Thanks for looking into this NON-urgent issue.
HyperScalper


Attachments:
File comment: Chart Workspace entry is expanded, as Strategy module adds graphic objects even if collapsed, it expands again
ChartTreeViewForcedExpanded.PNG [150.58 KiB]
Downloaded 345 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 

Jump to:  

cron
  © 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