diff --git a/var/www/modules/base64Decoded/Flask_base64Decoded.py b/var/www/modules/base64Decoded/Flask_base64Decoded.py index 0d997ad5..0ecf2c2e 100644 --- a/var/www/modules/base64Decoded/Flask_base64Decoded.py +++ b/var/www/modules/base64Decoded/Flask_base64Decoded.py @@ -63,8 +63,8 @@ def base64Decoded_page(): date_to = request.args.get('date_to') type = request.args.get('type') - #date_from = '20180628' - #date_to = '20180628' + #date_from = '20180628' or date_from = '2018-06-28' + #date_to = '20180628' or date_to = '2018-06-28' if type is not None: #retrieve + char @@ -218,7 +218,7 @@ def range_type_json(): date_to = request.args.get('date_to') date_from = '20180601' - date_to = '20180706' + date_to = '20180709' date_range = [] if date_from is not None and date_to is not None: diff --git a/var/www/modules/base64Decoded/templates/base64Decoded.html b/var/www/modules/base64Decoded/templates/base64Decoded.html index 78aae1db..60aceaae 100644 --- a/var/www/modules/base64Decoded/templates/base64Decoded.html +++ b/var/www/modules/base64Decoded/templates/base64Decoded.html @@ -39,6 +39,10 @@ } .bar:hover{ fill: brown; + cursor: pointer; + } + .bar_stack:hover{ + cursor: pointer; } .svgText { pointer-events: none; @@ -102,7 +106,11 @@ {% if l_64|length != 0 %} -

Today Base64 files:

+ {% if date_from|string == date_to|string %} +

{{ date_from }} Base64 files:

+ {% else %} +

{{ date_from }} to {{ date_to }} Base64 files:

+ {% endif %} @@ -159,6 +167,7 @@ + + + + + + -{% if not type and not daily_type_chart %} - -{% endif %} diff --git a/var/www/modules/base64Decoded/templates/base64_types.html b/var/www/modules/base64Decoded/templates/base64_types.html index 2c2f6d60..addb0c37 100644 --- a/var/www/modules/base64Decoded/templates/base64_types.html +++ b/var/www/modules/base64Decoded/templates/base64_types.html @@ -48,23 +48,23 @@ -
+
@@ -82,7 +82,7 @@ var yAxis = d3.axisLeft(y); var color = d3.scaleOrdinal(d3.schemeSet3); -var svg = d3.select("#chart").append("svg") +var svg = d3.select("#barchart_type").append("svg") .attr("id", "thesvg") .attr("viewBox", "0 0 1000 500") .attr("width", width + margin.left + margin.right) @@ -92,20 +92,6 @@ var svg = d3.select("#chart").append("svg") function barchart_type(url, id) { - /*var stack = d3.stack() - stack.values(function (d) { return d.values; }) - .offset("zero") - .x(function (d) { return x(d.label); }) - .y(function (d) { return d.value; });*/ - - /*var area = d3.svg.area() - .interpolate("cardinal") - .x(function (d) { return x(d.label); }) - .y0(function (d) { return y(d.y0); }) - .y1(function (d) { return y(d.y0 + d.y); });*/ - - //var color = d3.scale.ordinal().range(["#001c9c","#101b4d","#475003","#9c8305","#d3c47c"]); - d3.json("/base64Decoded/range_type_json") .then(function(data){ @@ -126,6 +112,8 @@ function barchart_type(url, id) { d.total = d.mapping[d.mapping.length - 1].y1; }); + console.log(data) + x.domain(data.map(function (d) { return (d.date).substring(5); })); //E y.domain([0, d3.max(data, function (d) { return d.total; })]); @@ -165,6 +153,18 @@ function barchart_type(url, id) { .on("mouseout", function (d) { removePopovers(); }) .on("click", function(d){ window.location.href = "/base64Decoded/" +'?type='+ d.name +'&date_from='+d.label+'&date_to='+d.label; }); + data.forEach(function(d) { + if(d.total != 0){ + svg.append("text") + .attr("class", "bar") + .attr("dy", "-.35em") + .attr('x', x(d.date.substring(5)) + x.bandwidth()/2) + .attr('y', y(d.total)) + .style("text-anchor", "middle") + .text(d.total); + } + }); + drawLegend(varNames); }); @@ -213,14 +213,14 @@ function showPopover (d) { $(this).popover('show') } -VIZ.onResize = function () { +chart.onResize = function () { var aspect = 1000 / 500, chart = $("#thesvg"); var targetWidth = chart.parent().width(); chart.attr("width", targetWidth); chart.attr("height", targetWidth / aspect); } -window.VIZ = VIZ; +window.chart = chart;