javascript - how to make column into on click event for HTML href in googlechart and VB -
javascript - how to make column into on click event for HTML href in googlechart and VB -
i making google chart in vb module of dnn 7+ website. attempting create column 0 clickable html link(column 7) bring new page. have attempted follow 1, 2, 3. chart works until add together code //click event.
// sql command creating datatable not listed returns //create google chart format strjson += "google.setonloadcallback(drawvisualization); function drawvisualization() { " & _ "var info = new google.visualization.datatable();" strjson += "data.addcolumn('string', 'agronomist', {textstyle: 5});" strjson += "data.addcolumn('number', 'current contracts');" strjson += "data.addcolumn('number', 'current other income');" strjson += "data.addcolumn('number', 'py contracts');" strjson += "data.addcolumn('number', 'py other income');" strjson += "data.addcolumn('number', 'pye contracts');" strjson += "data.addcolumn('number', 'pye other income');" strjson += "data.addcolumn('string', 'htmllink');" //parse sql info table row 3 rows , append strjsondata chart each row datarow in dt.rows if (row!cd1fee > 0) orelse (row!cdofee > 0) //limit names current year income strjsondata="['',"&format(row!cd1fee,0.0)&","&format(row!cdofee,0.0)&",0,0,0,0,'']," strjsondata2="['"&row!agronname.tostring&"',0,0,"&format(row!py1fee,0.0)&","& _ "&format(row!pyofee, 0.0) & ",0,0, 'www.google.com']," strjsondata3 = "['',0,0,0,0,"&format(row!pye1fee, 0.0)&"," & format(row!pyeofee, 0.0) & ", '']," //format name, 6 income columns 3 stacked rows, htmllink 'current date(cd) contracts , fees strjson += " data.addrows([" & strjsondata & "]); " 'past year(py) contracts , fees carried on cd strjson += " data.addrows([" & strjsondata2 & "]); " 'past year(pye) contracts , fees total strjson += " data.addrows([" & strjsondata3 & "]); " end if if cdbl(row!cd1fee) > dblmax dblmax = cdbl(row!cd1fee) end if next //subtract lastly comma strjson = strjson.substring(0, strjson.length - 1) //create dataview subset hide column 7 strjson += "var view = new google.visualization.dataview(data);" strjson += " view.setcolumns([0, 1, 2, 3, 4, 5, 6]);" //set chart options through assorted variables strjson += "var options = {width: " & iwidth & ", height: " & iheight & ", "interpolatenulls: true" & strpoint & ", allowhtml: true, isstacked:" & isstacked & "}; " //click event strjson += "new google.visualization.events.addlistener(chart, 'select',function(){" strjson += "selection = chart.getselection();" strjson += "var row = selection[0].row;" strjson += "var htmllink = data.getvalue(row, 7);" strjson += "var agronname = view.getvalue(row,0);" strjson += "location.href = 'htmllink'; });" //add execution code strjson += "var chart = new google.visualization.barchart"& _ "(document.getelementbyid('chart_div'));" & _ "chart.draw(view, options); " //call chart strjson += "} </script>" litjson.text = strjson <script type="text/javascript" src="https://www.google.com/jsapi"></script> <asp:literal runat="server" id="litjson"></asp:literal> <div id="chart_div"></div>
javascript jquery html vb.net
Comments
Post a Comment