How we can filter the json and dynamically pass the data to create multiline chart in mango automation
-
@himanshu said in How we can filter the json and dynamically pass the data to create multiline chart in mango automation:
toilet=TSTE-H2&dp=Temperature&dp=State&type=shioiaq2
I suggest you change dp to dp1 and dp2. By using dp twice you overwrite the parameter.
Secondly, have you read this help doc?
https://docs-v3.mango-os.com/dynamic-floor-plan
Only out with my phone at the moment so I dont have an active mango instance handy! Only whats in my head...
That doc explains how to attach params to components in the dashboard.Fox
-
@mattfox
Thanks Mate..
But the url is coming from different page.
Like <a ng-href="www.testurl.com/ui/testpage/?toilet=TSTE-H2&dp=Temperature&dp=State&type=shioiaq2"and now on testpage.html
i am using <ma-state-params> where i want data to get placed on basis of URL. -
As I said, read the help docs, create a watchlist with query as the type and add your parameters in there. Leverage them with the stateparams and apply them to the watchlist lookup
https://docs-v3.mango-os.com/linking-to-dynamic-pages
Fox
-
@mattfox
Hey Mate,
as per you above example I am doing the same thing but my problem is...
I want to access those params in one of my controller/component file.<a ng-href="www.testurl.com/ui/testpage/?toilet=TSTE-H2&dp=Temperature&dp=State&type=shioiaq2">
This link would redirect me to my component called testpage.html in that file i am unable to access the params .
I want to access my params in my components HTML file as well as controller file. -
What's your controller?
Paste all code here. May as well look at what you are doing.
Are you extending with the userModule? -
@mattfox
Yes we are extending the userModule.
I just want to "get" the param in html / controller file . -
Sorry am a little overrun, however, this is their dashboard repo.
https://github.com/infiniteautomation/ma-dashboards/tree/3.7.xThis should shed some light on how their stateparams work
Fox
-
Just had a thought, thinking about something I did recently... I didnt care much for params since I had my own components doing the heavy lifting.. So I used the $state provider and pulled in the url, split by / then use what was on the end. Why dont you do the same with the ? and the &? Then split each result by = for your key value pairs and run as needed. Just one of those shower thoughts haha.
EDIT: Nope sorry, completely ballsed that one up. If you want your params, add to the menu item:
?item1&item2
Do not add = in your menu link. Just do that and your stateparams will be available.
ie: your menu link will be./mycomponentpage?thisDevice&thatvalue&anotherkey
Your $state.params will be
{ thisDevice: '', thatvalue:'', anotherkey:'' }
Fox
-
@himanshu Does this help page answer your question ? https://docs-v3.mango-os.com/linking-to-dynamic-pages
-
@craigweb
No this in not useful in my scenario as I have urn passing to one of my component and I want to use those URL parameters in component.This example only works when we created two pages from dashboard designer and then linking to each another.
But not working with page to component parsing. -
Refer to your other post, I left an update there should that help you
Fox
-
It is the exact same concept.:
<ma-state-params on-change="designer.parameters.dn = $stateParams.dn" update-params="designer.updateParams"></ma-state-params>
this component takes the URL parameters and puts them into a object called designer.updateParams. That object can be used anywhere now in the pages scope.