farhan
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by farhan
-
-
Hi,
I am new to javascript and jChartfx. I am trying to create a pie but get this error
-- crosstabdataprovider cannot be accessed fron undefined. probably the cfx.data object is null
- even if I dont use crosstabdataprovider there is no graph created
function loadStatsGraph(data) {
chartStats = new cfx.Chart();
chartStats.setGallery(cfx.Gallery.Pie);
var ldata = [{ "Count": 10, "status": "Successful calculation" }, { "Count": 90, "status": "UnSuccessful calculation"}];
chartStats.setDataSource(ldata);
var fields = chartStats.getDataSourceSettings().getFields();
var field1 = new cfx.FieldMap();
field1.setName("status");
field1.setUsage(cfx.FieldUsage.RowHeading);
fields.add(field1);
var field2 = new cfx.FieldMap();
field2.setName("Count");
field2.setUsage(cfx.FieldUsage.ColumnHeading);
fields.add(field2);
var crosstab = new cfx.data.CrosstabDataProvider();
crosstab.setDataSource(chartStats.getDataSource());
chartStats.setDataSource(crosstab);
var data = chartStats.getData();
data.setSeries(1);
//chartStats.getAllSeries().getPointLabels().setVisible(true);
var titles = chartStats.getTitles();
var title = new cfx.TitleDockable();
title.setText("Build Statistics");
titles.add(title);
var divHolder = document.getElementById('divStats');
chartStats.create(divHolder);
}
Regards
Farhan
Problem with creating pie
in General Questions
Posted
Hi Juan,
Thank you for the response.
I managed to solve the issue. The problem was with the UI where I didn't set the div width and height which accomodates the graph control. It was a wrong assumption on my part that the div will automatically size based on graph.
Best Regards