How would I convert this Javascript example from the "Programmer's Guide"/"Passing Data"/"Using the Crosstab Data Provider" to use the jQuery/JavaScript object syntax?
You can post now and register later.
If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.
Question
DanielL_550
How would I convert this Javascript example from the "Programmer's Guide"/"Passing Data"/"Using the Crosstab Data Provider" to use the jQuery/JavaScript object syntax?
var items = [
{ "Name": "John", "Year": 2008, "Sales": 49027},
{ "Name": "John", "Year": 2009, "Sales": 45815},
{ "Name": "Robert", "Year": 2008, "Sales": 51489},
{ "Name": "Robert", "Year": 2009, "Sales": 55652},
{ "Name": "Mark", "Year": 2008, "Sales": 51924},
{ "Name": "Mark", "Year": 2009, "Sales": 55075},
{ "Name": "Kelly", "Year": 2008, "Sales": 55227},
{ "Name": "Kelly", "Year": 2009, "Sales": 36160},
{ "Name": "Brenda", "Year": 2008, "Sales": 54457},
{ "Name": "Brenda", "Year": 2009, "Sales": 51719}
];
chart1.setGallery(cfx.Gallery.Bar);
var fields = chart1.getDataSourceSettings().getFields();
var field1 = new cfx.FieldMap();
field1.setName("Name");
field1.setUsage(cfx.FieldUsage.RowHeading);
fields.add(field1);
var field2 = new cfx.FieldMap();
field2.setName("Year");
field2.setUsage(cfx.FieldUsage.ColumnHeading);
fields.add(field2);
var fieldVal = new cfx.FieldMap();
fieldVal.setName("Sales");
fieldVal.setUsage(cfx.FieldUsage.Value);
fields.add(fieldVal);
var crosstab = new cfx.data.CrosstabDataProvider();
crosstab.setDataSource(items);
chart1.setDataSource(crosstab);
Thank you.
Link to comment
Share on other sites
0 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.