• U
    uelojazz

    hello
    i try to make a simple serial chart to work as 3d but the grids behind the bars are rendered as 3d and it looks really confusing.

    <ma-point-query query="{name:'Module Daily Energy 01'}" limit="1" points="points2"></ma-point-query>
                     <ma-point-values points="points2" values="combined22" from="dateBar.from" to="dateBar.to" rollup="MAXIMUM" rendered="true" rollup-interval="1 DAYS">
              </ma-point-values>
    
    <ma-serial-chart style="height: 400px; width: 100%" series-1-title="Energia Mensile Totale" values="combined22" points="points2" legend="true" default-type="column" export=true options='{
            "theme": "light",
            "type": "serial",
            "depth3D": 20,
             "angle": 30
            }'>
            </ma-serial-chart>
    

    the result is this one and you can see the white background white lines that are shwon as 3d
    0_1533826405498_Screenshot_2018-08-09 View page - Innova Solare.png

    In a basic 3d amchart example the grid is not like that https://www.amcharts.com/demos/3d-bar-chart/
    I tried to change the grid alpha of ValueAxes and CategoryAxis via the options with "gridAlpha":1 but whatever is above 0 the alpha doesnt change
    I tried to change the amchart theme from light to dark but it deosnt work .. how do we switch amchart theme via mango ? because in the options the "theme": "black", is not working or any other theme

    And right now as i tried to export as jpg to post it here i realized that as soon as i click the download as button on upper right corner then suddenly the grid is render to normal and not as 3d and its like that which is correct
    0_1533826786653_Screenshot_2018-08-09 View page - Innova Solare(1).png
    I tried to look in css and debug in files like
    /web/resources/amcharts-3.13/themes/patterns.js
    /web/resources/mango-2.0/SerialChart.js
    but couldnt find the cause ...
    As it seems its should be a conflict with some other mango class or whatever custom amchart initialisation you are making in mango
    Any idea ?
    thank you :)

    posted in How-To read more
  • U
    uelojazz

    @Jared-Wiltshire thank you very much !
    yes i figured it out how to sort the output of a ma-point-statistics with ma-calc..
    Can you help me out how to sort an output of a ma-point-values ?
    Im not sure how which variable exaclty i have to orderBy and how to correctly to the ng-repeat.
    Basically this was my last question, how to sort the combined array of a ma-point-values https://forum.infiniteautomation.com/topic/3603/sorting-an-output-array-of-ma-point-statistics/4]

    Also do you have any link of User module URL examples (or an actual page that you are allowed to share) .
    Just to get ideas and see how to properly write components, modules,controllers etc in the userModule.js of mango
    Thank you very much !

    posted in Scripting general Discussion read more
  • U
    uelojazz

    any help on the above questions ? :)
    Can you at least help me out how to orderBy the combined array by the biggest value ?

    <ma-now update-interval="1 MINUTES" output="now"></ma-now>
    <ma-calc input="(now | maDate: 'HH')*60++(now | maDate: 'mm')--1"   output="rollupHours"></ma-calc>
    <ma-calc input="now | maMoment:'startOf':'day'" output="myfrom"></ma-calc>
    
    <ma-point-query query="'or(name=like=STR_4.*,name=like=*STR_5.*,name=like=*STR_6.*,name=like=STR_7.*,name=like=*STR_8.*,name=like=*STR_9.*)'" limit="300" sort="'-name'" points="points1"></ma-point-query>
    <ma-point-values points="points1" from="myfrom" to="now" values="combined"  rollup="INTEGRAL" rollup-interval="{{rollupHours}} MINUTES" ></ma-point-values>
    
    <!-- here im trying somehow to sort the combined array by biggest values .. how to do it with my calc ? what exactly im supposed to write inthe orderBy since this array has not keys ?-->
    <ma-calc input="combined" |orderBy:'value_' output="combined_sorted"></ma-calc>
    
    <!-- and here im trying to print the output by orderBy .. so i would need the biggest value on top and not sorted by name as is by default -->
    <div ng-repeat="(index,value) in combined |orderBy:value['value_' + point.xid]">
        <div ng-repeat="point in points1">XID: {{point.xid}} , Time: {{value.timestamp | maMoment:'format':'DD/MM/YYYY'}} ,Point Name: {{point.name}} ,Point Value:  {{value['value_' + point.xid]}}</div>
    </div>
    

    My output is the following which i would like to have it sorted my the biggest Point Value .. how to do this with ng-repeat and orderBy ??
    thank you very much

    XID: ST_000924 , Time: 27/06/2018 ,Point Name: STR_9.24 ,Point Value: 107.25
    XID: ST_000923 , Time: 27/06/2018 ,Point Name: STR_9.23 ,Point Value: 152675.05
    XID: ST_000922 , Time: 27/06/2018 ,Point Name: STR_9.22 ,Point Value: 154184.4
    XID: ST_000921 , Time: 27/06/2018 ,Point Name: STR_9.21 ,Point Value: 0.6

    And what i would like to have is :

    XID: ST_000922 , Time: 27/06/2018 ,Point Name: STR_9.22 ,Point Value: 154184.4
    XID: ST_000923 , Time: 27/06/2018 ,Point Name: STR_9.23 ,Point Value: 152675.05
    XID: ST_000924 , Time: 27/06/2018 ,Point Name: STR_9.24 ,Point Value: 107.25
    XID: ST_000921 , Time: 27/06/2018 ,Point Name: STR_9.21 ,Point Value: 0.6

    posted in Scripting general Discussion read more
  • U
    uelojazz

    thank you , didnt know all the capabilities of the ma-calc are there more examples or documentation available? i guess it can be used in various ways.
    I have multiple errors now in my console
    Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
    Watchers fired in the last 5 iterations: [[{"msg":"fn: r","newVal":[{"hasData":true,"first":"...","last":"...","start":"...","minimum":"...","maximum":"...","average":"...","integral":"...","sum":"...","count":6912},

    Basically my code now looks like that:

    <ma-calc input="day | maMoment:'add':preset:'days'" output="day2"></ma-calc>
    <ma-calc input="day2 | maMoment:'set':{'hour': 5, 'minute': 0}" output="myfrom"></ma-calc>
    <ma-point-query query="'or(name=like=STR_4.*,name=like=*STR_5.*,name=like=*STR_6.*,name=like=STR_7.*,name=like=*STR_8.*,name=like=*STR_9.*)'" limit="300" points="points1"></ma-point-query>
    <ma-point-values points="points1" values="combined" from="myfrom" to="dateBar.to" rollup="INTEGRAL" rollup-interval="1 DAYS">
    </ma-point-values>
    
    <ma-point-statistics points="points1" rendered=false from="myfrom" to="dateBar.to" display-mode="INTEGRAL" timeout=7000 statistics="statsObj"></ma-point-statistics>
    
    <ma-calc input= statsObj|orderBy:'-integral.value'|maFirst  output="max" ></ma-calc>
    <ma-calc input= statsObj|orderBy:'-integral.value' output="sorted_integrals" ></ma-calc>
    <ma-calc input= "((max.integral.value) * 0.8)" output="max8" ></ma-calc>
    
    <div ng-repeat="(index,value) in sorted_integrals">
        <div ng-repeat="point in points1">XID: {{point.xid}} , Time: {{value.timestamp | maMoment:'format':'DD/MM/YYYY'}} ,Point Name: {{point.name}} ,Point Value:  {{value['value_' + point.xid]}}</div>
    
    </div>
    
    1. Seems that those ma-calc are updating their values constantly .. tried to timeout the statistics in 7seconds but didnt work .. is this the reason of the errors in the console ?

    2. i would like to filter and get only the integral values of my statistics object so i can print that array sorted with the ng-repeat ..
      first line should be the biggest integral ..
      Tried with display-mode="INTEGRAL" in the ma-point-statistcs directive but im not sure exactly what is does since there is no example in the documentation ..is it supposed to filter only the integral values ?
      Also i tried to filter it and print it by

    <ma-calc input= statsObj |filter:{statistics:'INTEGRAL'}|orderBy:'-integral.value' output="sorted_integrals" ></ma-calc>
    
    <div ng-repeat="(index,value) in sorted_integrals">
        <div ng-repeat="point in points1">XID: {{point.xid}} , Time: {{value.timestamp | maMoment:'format':'DD/MM/YYYY'}} ,Point Name: {{point.name}} ,Point Value:  {{value['value_' + point.xid]}}</div>
    
    </div>
    

    but its not working. the sorted_integrals still contains all the statistics like average, first etc that i dont need in order to correctly ng-repeat <div ng-repeat="(index,value) in sorted_integrals">

    3)also my

    <div ng-repeat="(index,value) in sorted_integrals">
        <div ng-repeat="point in points1">XID: {{point.xid}} , Time: {{value.timestamp | maMoment:'format':'DD/MM/YYYY'}} ,Point Name: {{point.name}} ,Point Value:  {{value['value_' + point.xid]}}</div>
    
    </div>
    

    Is not sorted by the biggest integral.. it gives me the default sort of the point XID of the ma-point-query

    And it gets even more complicated when i have null or undefined values in my integral values .. the orderby by default sorts the nulls and undefined as greater than numbers ... tried few workarounds like the fowllowing but none of them work.. how to sort it correctly and keep the nulls and undefined at the end so i get the biggest value first ?

    <ma-calc input= statsObj| orderBy:['integral.value==null || integral.value']  output="max" ></ma-calc>
    <ma-calc input= statsObj| orderBy:['!integral.value', '-integral.value', ]  output="max" ></ma-calc>
    

    Basically i want to sort the statistics object by biggest integral, then keep only the integral values and then print a table of the sorted values withe their corresponding data point names and xid
    What im doing wrong ?
    thank you very much :)

    posted in Scripting general Discussion read more
  • U
    uelojazz

    Hello
    im trying sort an output array of a ma-point-statistics .. I sort it correctly but then i need to be able to get or print or copy the max value to a variable
    Basically i have

    <ma-calc input="day | maMoment:'add':preset:'days'" output="day2"></ma-calc>
    <ma-calc input="day2 | maMoment:'set':{'hour': 5, 'minute': 0}" output="from"></ma-calc>
    <ma-point-query query="'or(name=like=STR_5*)'" limit="300" points="box5"></ma-point-query>
    <ma-point-values points="box5" values="box5_val" from="from" to="dateBar.to" rollup="INTEGRAL" rollup-interval="1 DAYS">
    </ma-point-values>
    <ma-point-statistics points="box5" rendered=false from="from" to="dateBar.to" statistics="statsObj"></ma-point-statistics>
    
    {{ statsObj | orderBy:'-integral.value'}}
    {{statsObj[0].integral.value }}
    <script>
    console.log(statsObj);
    </script>
    

    I would expect that the {{statsObj[0].integral.value }} would give me the 0 entry of my sorted array so the max integral value .. but it doesnt . it still gives me the first entry of the unsorted array..
    Is there a way to copy it to a new array and there have the sorted one ?

    {{statsObj2=statsObj | orderBy:'-integral.value'}}
    {{statsObj2[0].integral.value }}
    

    the above is not working
    maybe with javascript ?

    1. by the way i try to console.log the statsObj and i got error is not defined .. how do i console.log the output of any of the mango directives ?
    <script>
    console.log(statsObj);
    </script>
    

    the above gives me error statsObj is undefined

    1. basically im trying to find the maximum of integral of few data points
      What is the best approach that i have above?
      a)
    <ma-point-query query="'or(name=like=STR_5*)'" limit="300" points="box5"></ma-point-query>
    <ma-point-values points="box5" values="box5_val" from="from" to="dateBar.to" rollup="INTEGRAL" rollup-interval="1 DAYS">
    </ma-point-values>
    

    or b)

    <ma-point-query query="'or(name=like=STR_5*)'" limit="300" points="box5"></ma-point-query>
    <ma-point-statistics points="box5" rendered=false from="from" to="dateBar.to" statistics="statsObj"></ma-point-statistics>
    

    which is the fastest computing method and more clever way to do it ?
    In the same page i will have multiple pairs of (queries and ma-point-statistics) or (queries and ma-point-values) .. Which is the one that will crash less the system and is more time and cpu efficient?
    thank you !

    posted in Scripting general Discussion read more