• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    How we can filter the json and dynamically pass the data to create multiline chart in mango automation

    Mango General
    3
    21
    7.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      himanshu
      last edited by

      How we can filter the JSON and dynamically pass the data to create multiline chart in mango automation.

      I am getting my JSON value from <ma-get-point-value> and on filtering the data with few parameters.
      Its throwing errors.

      "Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!"

      1 Reply Last reply Reply Quote 0
      • MattFoxM
        MattFox
        last edited by

        Can you show me the format of your data? I wrote a component to help another user format their data from JSON to the structure required by the amcharts to work as desired.
        Might be worth looking up what I did and see if aligns with your work.

        Fox

        Do not follow where the path may lead; go instead where there is no path.
        And leave a trail - Muriel Strode

        H 1 Reply Last reply Reply Quote 0
        • H
          himanshu @MattFox
          last edited by

          @mattfox

          {{myIAQTemp=(designer.points | filter:{name:'Temperature'}:true | maFilterByTags:{'Sensor Type': 'shioiaq2'}:true | limitTo:2);""}}

          This is the way I am trying to filter the data and passing the value in the ma-point-value and ma-serial-chart.

          my json contains
          [
          {
          name: 'Temperature',
          "tags": {
          "Sensor Type": "shioiaq2",
          }
          },
          {
          name: 'State',
          "tags": {
          "Sensor Type": "shioiaq2",
          }
          }
          ]

          I want to filter only on temperature and sensor type
          and exclude the object of name : state

          1 Reply Last reply Reply Quote 0
          • MattFoxM
            MattFox
            last edited by MattFox

            If that is the case I recommend using a meta data source.
            Use this datapoint as the context point and return the temperature value after decoding it with JSON.parse
            Sort through the object and as said before, return the temperature value.

            The meta point can then be used to populate your charts. Hope that helps!
            Although, what is you actual value? I do not see anything numerical
            Fox

            Do not follow where the path may lead; go instead where there is no path.
            And leave a trail - Muriel Strode

            H 1 Reply Last reply Reply Quote 0
            • H
              himanshu @MattFox
              last edited by himanshu

              @mattfox
              Hey Mate Can you please explain me with small snippet of code / any example please.
              Values are not my concern as values are getting passed properly and even the graph is getting created.

              As I filtered the data like this
              {{myIAQTemp=(designer.points | filter:{name:'Temperature'}:true | maFilterByTags:{'Sensor Type': 'shioiaq2'}:true | limitTo:2);""}}
              its giving me the output of graph accurate as I want...

              "Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!"

              But this error is ruining my life..it keeps on coming on page load after implementing that filter.

              1 Reply Last reply Reply Quote 0
              • MattFoxM
                MattFox
                last edited by MattFox

                Ok first up. Show all of your markup in code tags. First it appeared you were trying to derive values from what you had stored in datapoints. I see you were confused and actually meant its JSON store data for a watchlist.
                Use ma point query and build a RQL query using the watchlist builder. This way you can pull only what you want.

                <ma-point-query query="'and(eq(name,Temperature),eq(tags.Sensor Type,shioiaq2))&limit(2)'" points="tmpPts"> </ma-point-query>
                
                <div ng-repeat="pt in tmpPts">
                <ma-point-values .... >
                
                <ma-serial-chart .... >
                </div>
                
                

                Once you markup is visible we can get rid of your digest error.

                Fox

                Do not follow where the path may lead; go instead where there is no path.
                And leave a trail - Muriel Strode

                H 1 Reply Last reply Reply Quote 1
                • H
                  himanshu @MattFox
                  last edited by

                  @mattfox said in How we can filter the json and dynamically pass the data to create multiline chart in mango automation:

                  shioiaq2

                  Thanks alot mate.
                  It worked for me..

                  Highly appreciated.
                  Thanks Alot.

                  1 Reply Last reply Reply Quote 0
                  • MattFoxM
                    MattFox
                    last edited by

                    Anytime, well done and good luck. Always here if needed.

                    Fox

                    Do not follow where the path may lead; go instead where there is no path.
                    And leave a trail - Muriel Strode

                    H 1 Reply Last reply Reply Quote 1
                    • H
                      himanshu @MattFox
                      last edited by

                      @mattfox
                      Yes I would require your help on one more topic..

                      I am passing the params from dashboard-designer
                      url:
                      ?toilet=TSTE-H2&dp=Temperature&dp=State&type=shioiaq2

                      and i want to dynamicaally fetch URL data in to one of html in
                      ma-state-params

                      MattFoxM 1 Reply Last reply Reply Quote 0
                      • MattFoxM
                        MattFox @himanshu
                        last edited by MattFox

                        @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

                        Do not follow where the path may lead; go instead where there is no path.
                        And leave a trail - Muriel Strode

                        H 1 Reply Last reply Reply Quote 0
                        • H
                          himanshu @MattFox
                          last edited by

                          @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.

                          1 Reply Last reply Reply Quote 0
                          • MattFoxM
                            MattFox
                            last edited by MattFox

                            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

                            Do not follow where the path may lead; go instead where there is no path.
                            And leave a trail - Muriel Strode

                            H 1 Reply Last reply Reply Quote 0
                            • H
                              himanshu @MattFox
                              last edited by

                              @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.

                              CraigWebC 1 Reply Last reply Reply Quote 0
                              • MattFoxM
                                MattFox
                                last edited by

                                What's your controller?
                                Paste all code here. May as well look at what you are doing.
                                Are you extending with the userModule?

                                Do not follow where the path may lead; go instead where there is no path.
                                And leave a trail - Muriel Strode

                                H 1 Reply Last reply Reply Quote 0
                                • H
                                  himanshu @MattFox
                                  last edited by himanshu

                                  @mattfox
                                  Yes we are extending the userModule.
                                  I just want to "get" the param in html / controller file .

                                  1 Reply Last reply Reply Quote 0
                                  • MattFoxM
                                    MattFox
                                    last edited by

                                    Sorry am a little overrun, however, this is their dashboard repo.
                                    https://github.com/infiniteautomation/ma-dashboards/tree/3.7.x

                                    This should shed some light on how their stateparams work

                                    Fox

                                    Do not follow where the path may lead; go instead where there is no path.
                                    And leave a trail - Muriel Strode

                                    1 Reply Last reply Reply Quote 0
                                    • MattFoxM
                                      MattFox
                                      last edited by MattFox

                                      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

                                      Do not follow where the path may lead; go instead where there is no path.
                                      And leave a trail - Muriel Strode

                                      1 Reply Last reply Reply Quote 0
                                      • CraigWebC
                                        CraigWeb @himanshu
                                        last edited by

                                        @himanshu Does this help page answer your question ? https://docs-v3.mango-os.com/linking-to-dynamic-pages

                                        H 1 Reply Last reply Reply Quote 0
                                        • H
                                          himanshu @CraigWeb
                                          last edited by

                                          @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.

                                          CraigWebC 1 Reply Last reply Reply Quote 0
                                          • MattFoxM
                                            MattFox
                                            last edited by

                                            Refer to your other post, I left an update there should that help you

                                            Fox

                                            Do not follow where the path may lead; go instead where there is no path.
                                            And leave a trail - Muriel Strode

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post