0

我有来自 vb.net 的数据,我想调用到 y 轴。

后面的代码:

 Dim yaxis As String
 If RadioButtonList1.SelectedItem.Value = 1 Then
     yaxis = "Fruit eaten"
 End If

 hidden10.Value = yaxis

javascript

 $(function () { 
    $('#container').highcharts({
        chart: {
            type: 'bar'
        },
        title: {
            text: 'Fruit Consumption'
        },
        xAxis: {
            categories: ['Apples', 'Bananas', 'Oranges']
        },
        yAxis: {
            title: {

               text: '** i want Fruit eaten here***'**

            }
        },
        series: [{
            name: 'Jane',
            data: [1, 0, 4]
        }, {
            name: 'John',
            data: [5, 7, 3]
        }]
    });
 });​


<asp:HiddenField ID="hidden10" runat="server" />
var a10 = $("#<%=hidden10.ClientID%>").val();  

如您所见,它显示文本:但我希望显示 hidden10 值...

我已经拥有的绘图功能

       function draw(d) {

           var testarray = JSON.parse(a);
           var testarray1 = JSON.parse(a1);
           var testarray2 = JSON.parse(a2);


           var yaxis = $("#<%=hidden10.ClientID%>").val();

testarray 是来自 backcode 的数据。

单选按钮的代码背后:

    Select Case RadioButtonList1.SelectedItem.Value
        Case 1

            Dim yaxis As String
            If RadioButtonList1.SelectedItem.Value = 1 Then
                yaxis = "fruit eaten"
            End If




            Dim serializer1 As New JavaScriptSerializer()

            Dim arrayJsonTest1 As String = serializer1.Serialize(testarray)
            Dim arrayJson11 As String = serializer1.Serialize(testarray1)
            Dim arrayJson12 As String = serializer1.Serialize(testarray2)

            hidden.Value = arrayJsonTest1
            hidden1.Value = arrayJson11
            hidden2.Value = arrayJson12

            ' Bind_kWhValues(Year1, Year2, Year3)
            ScriptManager.RegisterStartupScript(Me.Page, Me.GetType, "draw",         "javascript:draw(1);", True)



        Case 2
            Dim yaxis As String
            If RadioButtonList1.SelectedItem.Value = 2 Then
                yaxis = "fruits not eaten"
            End If

            hidden10.Value = yaxis


          ScriptManager.RegisterStartupScript(Me.Page, Me.GetType, "draw",         "javascript:draw(2);", True)
4

2 回答 2

1
yAxis: {
         title: {
                  text:Yaxis 
                 }
       },

上面的代码对我有用。确保 If RadioButtonList1.SelectedItem.Value = 1 Then this if 条件满足。我尝试了以下代码:

var Yaxis = 'default';
function draw(d) {

       var testarray = JSON.parse(a);
       var testarray1 = JSON.parse(a1);
       var testarray2 = JSON.parse(a2);
        if(d == 1)
        {
            Yaxis='Fruit Eaten..';

        }

        else  if(d == 2)
        {
           Yaxis='Fruit not  Eaten..';
        }
        else 
        {
            Yaxis='Your Default value here...';
        }


       }
}
于 2013-07-30T15:26:59.107 回答
1

y轴:{标题:{文本:Y轴}},

于 2014-04-16T13:10:25.190 回答