Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在googlechart和VB中将列设置为HTML href的点击事件_Javascript_Jquery_Html_Vb.net - Fatal编程技术网

Javascript 如何在googlechart和VB中将列设置为HTML href的点击事件

Javascript 如何在googlechart和VB中将列设置为HTML href的点击事件,javascript,jquery,html,vb.net,Javascript,Jquery,Html,Vb.net,我正在DNN7+网站的VB模块中制作谷歌图表。我正在尝试将列0变成一个可点击的HTML链接列7,它将显示一个新页面。我已尝试跟随。在我为//单击事件添加代码之前,该图表一直有效 // SQL command for creating datatable not listed returns //create google chart format strJSON += "google.setOnLoadCallback(drawVisualization); function dra

我正在DNN7+网站的VB模块中制作谷歌图表。我正在尝试将列0变成一个可点击的HTML链接列7,它将显示一个新页面。我已尝试跟随。在我为//单击事件添加代码之前,该图表一直有效

// SQL command for creating datatable not listed returns 
 //create google chart format
    strJSON += "google.setOnLoadCallback(drawVisualization); function drawVisualization() { " & _
                "var data = 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 data table row into 3 rows and append strJSONdata into chart
        For Each row As DataRow In dt.Rows
            If (row!CD1Fee > 0) OrElse (row!CDOFee > 0) Then //limit names to 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 into three stacked rows, HTMLlink
'current Date(CD) contracts and fees
     strJSON += " data.addRows([" & strJSONData & "]); " 
'Past year(PY) contracts and fees carried over to CD
    strJSON += " data.addRows([" & strJSONData2 & "]); " 
'Past year(PYE) contracts and fees total
    strJSON += " data.addRows([" & strJSONData3 & "]); " 
            End If
            If CDbl(row!CD1Fee) > dblMax Then
                dblMax = CDbl(row!CD1Fee)
            End If
        Next

        //subtract last comma
        strJSON = strJSON.Substring(0, strJSON.Length - 1)

        //create dataview subset to 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>
用这个例子解决了这个问题