binbot-charts 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -59,11 +59,7 @@ function TVChartContainer(_ref) {
59
59
  tvWidget.onChartReady(() => {
60
60
  if (orderLines.length > 0) {
61
61
  orderLines.forEach(order => {
62
- const orderLine = updateOrderLines(tvWidget, order);
63
- setChartOrderLines(draft => {
64
- draft.push(orderLine);
65
- return draft;
66
- });
62
+ updateOrderLines(tvWidget, order);
67
63
  });
68
64
  }
69
65
 
@@ -91,13 +87,20 @@ function TVChartContainer(_ref) {
91
87
  const updateOrderLines = (tvWidget, order) => {
92
88
  if (chartOrderLines && chartOrderLines.length > 0) {
93
89
  chartOrderLines.forEach(item => {
94
- item.remove();
90
+ if (item._data.bodyText == order.text) {
91
+ item.setText(order.text).setTooltip(order.tooltip).setQuantity(order.quantity).setPrice(order.price);
92
+ } else {
93
+ item.remove();
94
+ }
95
+ });
96
+ } else {
97
+ const lineStyle = order.lineStyle || 0;
98
+ const chartOrderLine = tvWidget.chart().createOrderLine().setText(order.text).setTooltip(order.tooltip).setQuantity(order.quantity).setQuantityFont("inherit 14px Arial").setQuantityBackgroundColor(order.color).setQuantityBorderColor(order.color).setLineStyle(lineStyle).setLineLength(25).setLineColor(order.color).setBodyFont("inherit 14px Arial").setBodyBorderColor(order.color).setBodyTextColor(order.color).setPrice(order.price);
99
+ setChartOrderLines(draft => {
100
+ draft.push(chartOrderLine);
101
+ return draft;
95
102
  });
96
103
  }
97
-
98
- const lineStyle = order.lineStyle || 0;
99
- const chartOrderLine = tvWidget.chart().createOrderLine().setText(order.text).setTooltip(order.tooltip).setQuantity(order.quantity).setQuantityFont("inherit 14px Arial").setQuantityBackgroundColor(order.color).setQuantityBorderColor(order.color).setLineStyle(lineStyle).setLineLength(25).setLineColor(order.color).setBodyFont("inherit 14px Arial").setBodyBorderColor(order.color).setBodyTextColor(order.color).setPrice(order.price);
100
- return chartOrderLine;
101
104
  };
102
105
 
103
106
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, console.log(chartOrderLines), /*#__PURE__*/_react.default.createElement("div", {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.2.7",
2
+ "version": "0.2.8",
3
3
  "name": "binbot-charts",
4
4
  "dependencies": {
5
5
  "react": "^17.0.1",