on 04-07-2016 7:30 AM
Hello Experts,
I am getting some Unknown error
Can any one help me to solve this ??
here is my view code:
<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc"
xmlns="sap.m" controllerName="demovizframe.V_chart"
xmlns:viz="sap.viz.ui5.controls"
xmlns:html="http://www.w3.org/1999/xhtml">
<Page title="Title">
<content>
<viz:VizFrame xmlns="sap.viz" id="idcolumn" >
</viz:VizFrame>
</content>
</Page>
</core:View>
my controller code :
var url2 ="http://xx.xx.xx.xx:8000/AC_ANALYTICS/Power111.xsodata/SENSOR_DETAILS1?$select=SO_TEXT_DT_MM_YYYY,HOU... eq '"+cval+"' &$format=json";
var salesModel2 = new sap.ui.model.json.JSONModel();
salesModel2.loadData(url2);
var oVizFrame = this.getView().byId("idcolumn");
var oDataset = new sap.viz.ui5.data.FlattenedDataset({
dimensions : [{
name : 'HOUR',
value : "{HOUR}"}],
measures : [{
name : 'TEMP',
value : '{ATM_TEMPERATURE}'} ],
data : {
path : "/d/results"
}
});
oVizFrame.setDataset(oDataset);
oVizFrame.setModel(salesModel2);
oVizFrame.setVizType('line');
oVizFrame.setVizProperties({
plotArea: {
colorPalette : d3.scale.category20().range()
}});
var feedValueAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "valueAxis",
'type': "Measure",
'values': ["TEMP"]
}),
feedCategoryAxis = new sap.viz.ui5.controls.common.feeds.FeedItem({
'uid': "categoryAxis",
'type': "Dimension",
'values': ["HOUR"]
});
oVizFrame.addFeed(feedValueAxis);
oVizFrame.addFeed(feedCategoryAxis);
Thanks in Advance,
Bharath
I think your oVizframe is undefined at the time you are trying to assign your dataset. When are you doing all the stuff in your controller? onInit/onBeforeRendering/onAfterRendering? The right time to do this would be onInit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are using the same controller for two different views. When loading the first view, the controller tries to get an element with the id "idcolumn", which is not available on view1.
You should better use a different controller for each view.
I can't exactly tell, if this fixes your problem as I'm getting a lot of errors cause of the invalid url. But when I remove the controller from the first view, the dataset is set correctly to the VizFrame
yeah that is the problem...
try deleting one view or use
var oVizFrame = sap.ui.getCore().getControl("idcolumn");
dont use same controller for two views.
I just combined your two views and put this code in onInit method.
take a look
JS Bin - Collaborative JavaScript Debugging
Regards
I Have 2 combobox and both are connected,, and now i want to display a chart based on 2nd combobox selection, thats why i am using 2nd view for chart,, and can you please guide me how to write these two views in a single view ??
here is my first View code,
<mvc:View height="20%" controllerName="demovizframe.V_chart" xmlns:core="sap.ui.core"
xmlns:mvc="sap.ui.core.mvc" xmlns:suite="sap.suite.ui.commons" xmlns:viz="sap.viz.ui5.controls" xmlns:layout="sap.ui.layout" xmlns="sap.m">
<layout:Splitter width="100%" height="100%">
<App>
<Page title="SAMPLE TESTING CODE">
<HBox justifyContent="SpaceAround">
<HBox>
<Label text="QUARTER:" class="LabelStyle" />
<ComboBox id="idCombo" items="{OdataModel>/Location_details}" selectionChange="onChange">
<core:Item text="{OdataModel>LM_LOCATION_ID_PK}"/>
</ComboBox>
</HBox>
<HBox>
<Label text="MONTH:" class="LabelStyle" />
<ComboBox id="oComboBox" selectionChange="onSelect">
</ComboBox>
</HBox>
</HBox>
</Page>
</App>
</layout:Splitter>
</mvc:View>
here is my 2nd view code,
<core:View controllerName="demovizframe.V_chart" xmlns:core="sap.ui.core" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc"
xmlns:viz="sap.viz.ui5.controls" xmlns="sap.m">
<App>
<Page title="Title">
<content>
<Label text="Product"/>
<ScrollContainer focusable="true" height="100%" horizontal="false" vertical="true" width="100%">
<viz:Popover id="idPopOver"></viz:Popover>
<viz:VizFrame height="700px" id="idcolumn" uiConfig="{applicationSet:'fiori'}" vizType="line" width="100%"></viz:VizFrame>
</ScrollContainer>
</content>
</Page>
</App>
</core:View>
Regards,
Bharath
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.