diff options
Diffstat (limited to 'wqflask/wqflask/static/new/javascript/create_interval_map.coffee')
-rw-r--r-- | wqflask/wqflask/static/new/javascript/create_interval_map.coffee | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/wqflask/wqflask/static/new/javascript/create_interval_map.coffee b/wqflask/wqflask/static/new/javascript/create_interval_map.coffee index cacba03e..2b4b20c8 100644 --- a/wqflask/wqflask/static/new/javascript/create_interval_map.coffee +++ b/wqflask/wqflask/static/new/javascript/create_interval_map.coffee @@ -1,4 +1,4 @@ -create_interval_map = ->
+create_interval_map = () ->
h = 500
w = 1200
margin = {left:60, top:40, right:40, bottom: 40, inner:5}
@@ -39,6 +39,7 @@ create_interval_map = -> create_interval_map()
$("#export").click =>
+
#Get d3 SVG element
svg = $("#topchart").find("svg")[0]
@@ -54,6 +55,29 @@ $("#export").click => form.find("#data").val(svg_xml)
form.find("#filename").val(filename)
form.submit()
+
+
+$("#export_pdf").click =>
+
+ #$('#topchart').remove()
+ #$('#chart_container').append('<div class="qtlcharts" id="topchart"></div>')
+ #create_interval_map()
+
+ #Get d3 SVG element
+ svg = $("#topchart").find("svg")[0]
+
+ #Extract SVG text string
+ svg_xml = (new XMLSerializer).serializeToString(svg)
+ console.log("svg_xml:", svg_xml)
+
+ #Set filename
+ filename = "interval_map_pdf"
+
+ #Make a form with the SVG data
+ form = $("#exportpdfform")
+ form.find("#data").val(svg_xml)
+ form.find("#filename").val(filename)
+ form.submit()
# two LOD charts within one SVG
#d3.json "data.json", (data) ->
|