on 01-02-2014 8:50 AM
when i use viz show pie chart encounter a issuse.
first time load this chart, can be ok. but when I jump to another page or others tab.
and then back to this page. the pie chart load failed.
show error:
Uncaught TypeError: Cannot call method 'removeChild' of null
my library is 1.16.6.
I create pie chart code:
var _skillCountModel = new sap.ui.model.json.JSONModel();
setTimeout(function() {
_skillCountModel.setData({
modelData : data
});
}, 4000);
var dataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [ {
axis : 1,
name : 'TAGNAME',
value : "{TAGNAME}"
} ],
measures : [ {
name : 'COUNT',
value : {
path : 'TAGCOUNT',
formatter : function($) {
return $;
}
}
} ],
data : {
path : "/modelData",
factory : function() {
}
}
});
// "oPieChart",
var oPieChart;
// var oPieChartID = "oPieChart";
// if (sap.ui.getCore().byId(oPieChartID) === undefined)
// {
oPieChart = new sap.viz.ui5.Pie("oPieChart", {
width : "80%",
height : "600px",
plotArea : {
// 'colorPalette' :
// d3.scale.category20().range()
},
/*
* title : { visible : true, text : 'Revenue By
* Country' },
*/
dataset : dataset
});
oPieChart.setModel(_skillCountModel);
var AllTagPiePanel = new sap.ui.commons.Panel(
'AllTagPiePanel',
{
title : new sap.ui.commons.Title(
{
text : "Skill Distribution For All Tags"
})
});
sap.ui.getCore().byId('AllTagPiePanel').addContent(
oPieChart);
sap.ui.getCore().byId('LayoutEngagementR').createRow(
AllTagPiePanel);
Panelright.addContent(allLayout);
Hi Heath,
I am really not an expert, but I can share what I have done during self learning.
As I Understand, you are facing an issue when you comeback to the page where your pie-chart exists.
I didn't came across this issue, for me the chart always loads fine whenever I navigate to that page.
I may not point out the exact issue, but please check whether the below code might help you. This is the only code which i wrote to display my pie-chart.
http://scn.sap.com/thread/3286039 - SAPUI 5 - Pie-Chart Issue -- I have pasted the code here which worked for me.
This is the code on the Index.html
oShell.addWorksetItem(new WI("wi_test",{key : "wi_test", text : "Test"}));
oShell.attachWorksetItemSelected(selectWorkItem);
oShell.setContent(getContent("wi_home_guest")); // this is my default page
oShell.placeAt("shellArea");
function selectWorkItem(oEvent) {
var key = oEvent.getParameter("key");
var oShell = oEvent.oSource;
oShell.setContent(getContent(key));
};
function getContent(key) {
if (aContent[key]) return aContent[key]; // if content is already created, return it directly
I don't exactly remember but I guess the above code which i have used to load the content if it is already created
if (key == "wi_home_cprofile") {
sap.ui.localResources("projconnectui5");
aContent[key] = sap.ui.view({id:"idNameConnectui51", viewName:"projconnectui5.NameConnectui5", type:sap.ui.core.mvc.ViewType.JS});
} else if (key == "wi_home_guest") {
var layout = new c.layout.MatrixLayout();
//
var cell = new c.layout.MatrixLayoutCell({colSpan:2});
var p3 = new c.Panel().setText("Information");
p3.addContent(new c.TextView({text:"No Information available."}));
cell.addContent(p3);
layout.createRow(cell);
sap.ui.localResources("projconnectui5");
aContent[key] = [ sap.ui.view({id:"idNameConnectui50", viewName:"projconnectui5.guest", type:sap.ui.core.mvc.ViewType.JS}),
layout];
}
return this.aContent[key];
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the oshell when second time load this page, will not generate new page, just load the old one, like this"oShell.setContent(getContent(key));" get the memory data, but just here load the page with pie chart throw exception"Uncaught TypeError: Cannot call method 'removeChild' of null" Seems viz core issue, how to fixed this problem in my code, this issue is very urgent, impact my project release. could you help me?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I change to another new solution to workaround, but still hava a new issuse. the solution is when I back to this page dont load old data, but create a new page to show this chart. and i also need to add below code and then can show " try { sap.ui.getCore().loadLibrary("sap.ui.commons"); } catch (e) { alert("This test page requires the library 'sap.ui.commons' which is not available."); throw (e); } try { sap.ui.getCore().loadLibrary("sap.ui.table"); } catch (e) { alert("This test page requires the library 'sap.ui.table' which is not available."); throw (e); } try { sap.ui.getCore().loadLibrary("sap.ui.ux3"); } catch (e) { alert("This test page requires the library 'sap.ui.ux3' which is not available."); throw (e); } try { sap.ui.getCore().loadLibrary("sap.viz"); } catch (e) { alert("This test page requires the library 'sap.ui.viz' which is not available."); throw (e); } " but the new issue is when i dispaly this chart againe the Legend can not displayed.
Legend cannot displayed!!!!! ???????
These are the libraries that I have used..
<script src="resources/sap-ui-core.js" -- this path might change
id="sap-ui-bootstrap"
data-sap-ui-libs="sap.service.visualization,sap.ui.commons,sap.ui.core,sap.ui.table,sap.ui.ux3,sap.viz"
data-sap-ui-theme="sap_goldreflection" >
</script>
<!-- add sap.ui.table,sap.ui.ux3 and/or other libraries to 'data-sap-ui-libs' if required -->
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.