diff --git a/hledger-web/static/hledger.js b/hledger-web/static/hledger.js index bc9438e68..5ad27c3aa 100644 --- a/hledger-web/static/hledger.js +++ b/hledger-web/static/hledger.js @@ -57,86 +57,6 @@ $(document).ready(function() { }); }); -//---------------------------------------------------------------------- -// REGISTER CHART - -//eslint-disable-next-line no-unused-vars -function registerChart($container, series) { - // https://github.com/flot/flot/blob/master/API.md - return $container.plot( - series, - { /* general chart options */ - xaxis: { - mode: "time", - timeformat: "%Y/%m/%d", - }, - selection: { - mode: "x" - }, - legend: { - position: 'sw' - }, - grid: { - markings: function () { - var now = Date.now(); - return [ - { - xaxis: { to: now }, // past - yaxis: { to: 0 }, // <0 - color: '#ffdddd', - }, - { - xaxis: { from: now }, // future - yaxis: { from: 0 }, // >0 - color: '#e0e0e0', - }, - { - xaxis: { from: now }, // future - yaxis: { to: 0 }, // <0 - color: '#e8c8c8', - }, - { - yaxis: { from: 0, to: 0 }, // =0 - color: '#bb0000', - lineWidth:1 - }, - ]; - }, - hoverable: true, - autoHighlight: true, - clickable: true, - }, - /* https://github.com/krzysu/flot.tooltip */ - tooltip: true, - tooltipOpts: { - xDateFormat: "%Y/%m/%d", - content: - function(label, x, y, flotitem) { - var data = flotitem.series.data[flotitem.dataIndex]; - return data[3]+" balance on %x after "+data[2]+" posted by transaction:
"+data[4]+"
"; - }, - onHover: function(flotitem, $tooltipel) { - $tooltipel.css('border-color',flotitem.series.color); - }, - }, - } - ).data("plot"); -} - -function registerChartClick(ev, pos, item) { - if (!item) { - return; - } - var targetselector = '#' + item.series.data[item.dataIndex][5]; - var $target = $(targetselector); - if ($target.length) { - window.location.hash = targetselector; - $('html, body').animate({ - scrollTop: $target.offset().top - }, 1000); - } -} - //---------------------------------------------------------------------- // ADD FORM diff --git a/hledger-web/templates/chart.hamlet b/hledger-web/templates/chart.hamlet index 78a77db3e..7beea6a26 100644 --- a/hledger-web/templates/chart.hamlet +++ b/hledger-web/templates/chart.hamlet @@ -1,3 +1,4 @@ +$# If $ is the first character in a line, it must be \-escaped to hide it from hamlet.