Hi,
Please can someone help me. I'm trying to populate a bar chart from the code behinddata in a web forms environment. I've serialized the data to json and put into a hidden field. Then trying to set that as the datasource but the report keeps coming up blank. What's wrong?
hdn1.value = JsonArray() End Sub
Public Class Sales
Public Property name As String Public Property data As String
End Class
Protected Function JsonArray() As String
Dim myArray As String
Dim obj As New Sales With {.name = "Sales", .data = "8067.96, 8099.93, 9175, 8874, 8478"}
Dim obj2 As New Sales With {.name = "Costs", .data = "8067.96, 8099.93, 9175, 8874, 8478"}
Dim objSales As New List(Of Sales)() From {obj, obj2}
Dim objSerializer As New JavaScriptSerializer()
myArray = objSerializer.Serialize(objSales)
Return myArray
End Function
jQuery(document).ready(function ($) {
var myTheme = 'blueopal';
var myds = $('#MainContent_hdn1').val();
alert(myds);
$("#chart").kendoChart({
datasource: {
data: myds
}, series: [{
field: "data"
}],
//seriesDefaults: { type: "verticalBullet" },
chartArea: {
height: 250
},
theme: myTheme,
tooltip: {
visible: true,
template: "#= series.name #: #= value #"
}
});
Please can someone help me. I'm trying to populate a bar chart from the code behinddata in a web forms environment. I've serialized the data to json and put into a hidden field. Then trying to set that as the datasource but the report keeps coming up blank. What's wrong?
hdn1.value = JsonArray() End Sub
Public Class Sales
Public Property name As String Public Property data As String
End Class
Protected Function JsonArray() As String
Dim myArray As String
Dim obj As New Sales With {.name = "Sales", .data = "8067.96, 8099.93, 9175, 8874, 8478"}
Dim obj2 As New Sales With {.name = "Costs", .data = "8067.96, 8099.93, 9175, 8874, 8478"}
Dim objSales As New List(Of Sales)() From {obj, obj2}
Dim objSerializer As New JavaScriptSerializer()
myArray = objSerializer.Serialize(objSales)
Return myArray
End Function
jQuery(document).ready(function ($) {
var myTheme = 'blueopal';
var myds = $('#MainContent_hdn1').val();
alert(myds);
$("#chart").kendoChart({
datasource: {
data: myds
}, series: [{
field: "data"
}],
//seriesDefaults: { type: "verticalBullet" },
chartArea: {
height: 250
},
theme: myTheme,
tooltip: {
visible: true,
template: "#= series.name #: #= value #"
}
});