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