Code: Select all
Define ChartData
! var v_chartdata= [
! ['Task', 'Hours per Day'],
! ['Work', 11],
! ['Eat', 2],
! ['Commute', 2],
! ['Watch TV', 2],
! ['Sleep', 7]
! ];
Code: Select all
Define ChartData
! var v_chartdata= [
! ['Task', 'Hours per Day'],
! ['Work', 11],
! ['Eat', 2],
! ['Commute', 2],
! ['Watch TV', 2],
! ['Sleep', 7]
! ];
Code: Select all
If CreateJSON(0)
sub1 = SetJSONArray(JSONValue(0))
sub2 = SetJSONArray(AddJSONElement(sub1))
SetJSONString(AddJSONElement(sub2),"Task")
SetJSONString(AddJSONElement(sub2),"Hours per Day")
sub2 = SetJSONArray(AddJSONElement(sub1))
SetJSONString(AddJSONElement(sub2),"Work")
SetJSONInteger(AddJSONElement(sub2),11)
;etc...
Debug ComposeJSON(0)
EndIf
Code: Select all
[..]
Protected ChartData
! v_chartdata = [
! ['Topping', 'Slices'],
! ['Mushrooms', 3],
! ['Onions', 1],
! ['Olives', 1],
! ['Zucchini', 1],
! ['Pepperoni', 2]
! ];
GoogleChart::SetChartGadgetAttribute(#PieChart, GoogleChart::#ChartData, ChartData)
Code: Select all
jsRef = CreateJSON(#PB_Any)
If jsRef
sub1 = SetJSONArray(JSONValue(jsRef))
sub2 = SetJSONArray(AddJSONElement(sub1))
SetJSONString(AddJSONElement(sub2),"Task")
SetJSONString(AddJSONElement(sub2),"Hours per Day")
sub2 = SetJSONArray(AddJSONElement(sub1))
SetJSONString(AddJSONElement(sub2),"Work")
SetJSONInteger(AddJSONElement(sub2),11)
;etc...
Debug ComposeJSON(jsRef)
EndIf
Code: Select all
Procedure AddToDataTable( ChartDataTable, txt.s, value.i )
! v_chartdatatable.addRows([[v_txt, v_value]]);
EndProcedure