• 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

    Selecting WatchList/Chart Series with a Button

    Dashboard Designer & Custom AngularJS Pages
    2
    4
    1.4k
    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.
    • R
      ristola
      last edited by

      I have a WatchList Chart with (6) Axis on the chart legend.
      Is it possible to create a Button to Select Certain Series instead of manually clicking on the each axis to enable / disable ?

      I would like to create a couple buttons to quickly group a few different axis points to quick view

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

        I remember asking myself a similar question last year, Stack Overflow is a dev's best friend when it comes to minor/extra functionality to extend what already exists.

        I did something to toggle a entire graph rather than using the legends so that it actually disappeared from the serial chart view but could still be turned back on again.

        You can rejig this to look through an array of title 'names' then just toggle them with a click of a button.
        Prob shouldn't use the $scope for this but I want to believe that since it's only called when the ma-button is clicked all is fine...

        // works for a single chart, goes by a name in a graph's title
        $scope.toggleChart = function(titleTerm)
        {
        	try
        	{
        		var allCharts = AmCharts.charts; //get all charts
        		for (var i = 0; i < allCharts.length; i++)  //simply put this loop inside another to iterate through multiple chart names
                        {
        			if(allCharts[ i].graphs.length>1)
        			{			
        				for(var graph=0; graph<allCharts[ i ].graphs.length;graph++)
        				{
        //use string,indexOf() to see if the title name is in the chart.
        					if (  allCharts[ i ].graphs[ graph ].hidden && allCharts[ i ].graphs[ graph ].title.indexOf(titleTerm)>-1 ){
        							   allCharts[ i ].showGraph( allCharts[ i ].graphs[ graph ] );
        							   break;
        					}
        					if ( allCharts[ i ].graphs[ graph ].title.indexOf(titleTerm)>-1 ){
        						allCharts[ i ].hideGraph( allCharts[ i ].graphs[ graph ] );	break;}		
        					}
        				}
        			}
        		}
        		catch(e){console.log(e);}
        	};
        

        Then to use it on the template page:

        <!--  swap out 'chartTitle' with ['chat1','char2','etc']  then loop inside controller function-->
        <md-button  id="" ng-click="toggleChart('chartTitle')" aria-label="Toggle Chart" >				
        				  Toggle Chart
        				  <md-icon md-menu-align-target style="margin: auto 3px auto 0;"><i class="material-icons">wb_cloudy</i></md-icon>				
        			</md-button> 
        

        Hope this gets you started in the right direction!

        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
        • R
          ristola
          last edited by

          Thanks MattFox for the reply,
          I guess I was looking for a enable / disable function, but just wasn't finding what i needed.

          This approach looks like i maybe able to achieve a similar approach.
          I will give it a twirl...

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

            Happy to help.
            Feel free to ask more questions if you get stuck, some of your code would be good to see too if you do require further assistance.

            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