From aad7292987f486886bf574107d5678ba1e879579 Mon Sep 17 00:00:00 2001 From: David Brazda Date: Tue, 9 May 2023 15:37:21 +0200 Subject: [PATCH] bugfix --- v2realbot/static/index.html | 3 +++ v2realbot/static/js/archivechart.js | 7 +++++-- v2realbot/static/js/archivetables.js | 5 +++++ v2realbot/static/js/realtimechart.js | 3 ++- v2realbot/static/js/utils.js | 16 ++++++++++++++++ v2realbot/static/main.css | 10 +++++++--- 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/v2realbot/static/index.html b/v2realbot/static/index.html index a45de82..e5bd764 100644 --- a/v2realbot/static/index.html +++ b/v2realbot/static/index.html @@ -67,6 +67,9 @@
+
+ +
diff --git a/v2realbot/static/js/archivechart.js b/v2realbot/static/js/archivechart.js index e56cbd1..816c9e3 100644 --- a/v2realbot/static/js/archivechart.js +++ b/v2realbot/static/js/archivechart.js @@ -491,6 +491,7 @@ function chart_archived_run(archRecord, data, oneMinuteBars) { chart.subscribeClick(param => { $('#trade-timestamp').val(param.time) + //toggle_vertical_line(param.time); if (archRecord.ilog_save == true) { fetch_log_data(param.time, archRecord.id); } @@ -531,6 +532,8 @@ function chart_archived_run(archRecord, data, oneMinuteBars) { toolTip.innerHTML += `
${JSON.stringify(tradeDetails.get(param.time),null,2)}
${price.toFixed(3)}
`; + console.log("toolTip.innerHTML",toolTip.innerHTML) + //inspirace // toolTip.innerHTML = `
Apple Inc.
// ${Math.round(100 * price) / 100} @@ -583,8 +586,8 @@ function fetch_log_data(timestamp, runner_id) { }, error: function(xhr, status, error) { var err = eval("(" + xhr.responseText + ")"); - window.alert(JSON.stringify(xhr)); - //console.log(JSON.stringify(xhr)); + //window.alert(JSON.stringify(xhr)); + console.log("Chyb pri dotazeni logu", JSON.stringify(xhr)); } }) } diff --git a/v2realbot/static/js/archivetables.js b/v2realbot/static/js/archivetables.js index 9d797e9..d11d18c 100644 --- a/v2realbot/static/js/archivetables.js +++ b/v2realbot/static/js/archivetables.js @@ -2,6 +2,11 @@ $(document).ready(function () { archiveRecords.ajax.reload(); + //button clear log + $('#button_clearlog').click(function () { + $('#lines').empty(); + }); + //disable buttons (enable on row selection) $('#button_show_arch').attr('disabled','disabled'); $('#button_delete_arch').attr('disabled','disabled'); diff --git a/v2realbot/static/js/realtimechart.js b/v2realbot/static/js/realtimechart.js index 0325c2f..c249dab 100644 --- a/v2realbot/static/js/realtimechart.js +++ b/v2realbot/static/js/realtimechart.js @@ -9,7 +9,8 @@ function populate_real_time_chart() { chart.subscribeClick(param => { //display timestamp in trade-timestamp input field - $('#trade-timestamp').val(param.time) + $('#trade-timestamp').val(param.time); + toggle_vertical_line(param.time); }); chart.subscribeCrosshairMove((param) => { diff --git a/v2realbot/static/js/utils.js b/v2realbot/static/js/utils.js index 2204eb9..ecce0fb 100644 --- a/v2realbot/static/js/utils.js +++ b/v2realbot/static/js/utils.js @@ -4,6 +4,7 @@ var chart = null var colors = ["#8B1874","#B71375","#B46060","#61c740","#BE6DB7","#898121","#4389d9","#00425A","#B5D5C5","#e61957"] var reset_colors = colors var indList = [] +var verticalSeries=null indConfig = {} settings = {} @@ -22,6 +23,18 @@ function get_ind_config(indName) { return null } +function toggle_vertical_line(time) { + if (verticalSeries) { + chart.removeSeries(verticalSeries) + } + verticalSeries = chart.addHistogramSeries({ + priceScaleId: '', + color: 'rgba(128, 128, 255, 0.25)', + scaleMargins: { top: 0, bottom: 0 }, + lastValueVisible: false, + }) + verticalSeries.setData([{ time: time, value: 1 }]) +} //LEGEND INIT var legendlist = document.getElementById('legend'); @@ -86,15 +99,18 @@ function cleanup_chart() { avgBuyLine = null volumeSeries = null vwapSeries = null + verticalSeries=null if (toolTip) { toolTip.style.display = 'none'; } } $( ".switcher" ).remove(); + $('#button_clearlog').hide(); } function initialize_chart() { $('#chartContainerInner').addClass("show"); + $('#button_clearlog').show(); //PUVODNI BILY MOD //var chartOptions = { width: 1045, height: 600, leftPriceScale: {visible: true}} diff --git a/v2realbot/static/main.css b/v2realbot/static/main.css index 09e28d7..a14a59f 100644 --- a/v2realbot/static/main.css +++ b/v2realbot/static/main.css @@ -238,9 +238,13 @@ html { } #msgContainer { - /* display: inline-block; */ - overflow: auto; - height: 568px; + display: inline-block; + /* overflow: auto; */ + height: 596px; +} + +.clearbutton { + margin-left: 29px; } /* na male obrazovce je log pod grafem, zobrazujeme tedy prvni logy nahore */