Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6013613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:34:28+00:00 2026-05-23T02:34:28+00:00

EDIT* * ** I want help with writing the two functions plotSingleCoverage and plotAllCoverage

  • 0

EDIT****

I want help with writing the two functions “plotSingleCoverage” and plotAllCoverage below. The major problem I have is that I don’t know how to search through all existing datasets on the page and then write out a single array in a dataset, or all array’s of the same sort in different datasets. So if anyone could push me in the right direction I would be more than happy =)

Flot Examples

    <div id="placeholder" style="width:600px;height:300px;"></div>

    <p id="choices">Show:</p>

<a href="javascript:plotSingleCoverage('Test1')">Show coverage of first test</a>
<a href="javascript:plotAllCoverage()">Show coverage of all tests</a>


<script type="text/javascript">
$(function () {
    var Test1 = {
        "date": {
            label: "Date",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        },        
        "time": {
            label: "Time",
              data: [[1, 209], [2, 201], [3, 201], [4, 134]]
        },
       "modules": {
            label: "Modules",
             data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }, 
        "cases": {
            label: "Cases",
             data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }, 
        "failed": {
            label: "Failed",
              data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }, 
        "cover": {
            label: "Cover",
data: [[1, 201], [2, 201], [3, 201], [4, 125]]
    }
}; 

var Test2 = {
        "date": {
            label: "Date",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        },        
        "time": {
            label: "Time",
              data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        },
       "modules": {
            label: "Modules",
             data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }, 
        "cases": {
            label: "Cases",
             data: [[1, 101], [2, 201], [3, 201], [4, 45]]
        }, 
        "failed": {
            label: "Failed",
              data: [[1, 301], [2, 454], [3, 43], [4, 125]]
        }, 
        "cover": {
            label: "Cover",
        data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }
}; 

var Test3 = {
    "date": {
        label: "Date",
        data: [[1, 201], [2, 201], [3, 201], [4, 125]]
    },        
    "time": {
        label: "Time",
          data: [[1, 201], [2, 201], [3, 201], [4, 125]]
    },
   "modules": {
        label: "Modules",
         data: [[1, 201], [2, 201], [3, 201], [4, 125]]
    }, 
    "cases": {
        label: "Cases",
         data: [[1, 201], [2, 201], [3, 201], [4, 125]]
    }, 
    "failed": {
        label: "Failed",
          data: [[1, 201], [2, 201], [3, 201], [4, 125]]
    }, 
    "cover": {
        label: "errover",
    data: [[1, 201], [2, 201], [3, 201], [4, 125]]
    }
};

/*Need help to write this function, it shall go to that dataset that its argument is, for example in this case it shall go to Test1 and read that cover and plot it in the #placeholder*    
function plotSingleCoverage(coverageToPlot){
    $.plot($("#placeholder"), [???]);
}
/*This function shall simply go through all avaible datasets and plot all cover array's*/
function plotAllCoverage(){
    $.plot($("#placeholder"), [???]);
}

});
</script>

 </body>
</html>

Thanks in advance =)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:34:29+00:00Added an answer on May 23, 2026 at 2:34 am

    You have a few variables that you can’t access in a convenient way. How about holding them in an array so you can loop on them easily and search for the right dataset to take actions on? (from my comment above)

    You can make an array of the available data sets like this: var datasets = new Array();.
    Then, when defining a new dataset, do datasets[] = { ...... } instead of every var Test1 = { ... };.

    var datasets = new Array();
    datasets[0] = {
        "date": {
            label: "Date",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        },        
        "time": {
            label: "Time",
            data: [[1, 209], [2, 201], [3, 201], [4, 134]]
        },
       "modules": {
            label: "Modules",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }, 
        "cases": {
            label: "Cases",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }, 
        "failed": {
            label: "Failed",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }, 
        "cover": {
            label: "Cover",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }
    }; 
    
    datasets[1] = {
        "date": {
            label: "Date",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        },        
        "time": {
            label: "Time",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        },
       "modules": {
            label: "Modules",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }, 
        "cases": {
            label: "Cases",
            data: [[1, 101], [2, 201], [3, 201], [4, 45]]
        }, 
        "failed": {
            label: "Failed",
            data: [[1, 301], [2, 454], [3, 43], [4, 125]]
        }, 
        "cover": {
            label: "Cover",
            data: [[1, 201], [2, 201], [3, 201], [4, 125]]
        }
    }; 
    

    Then, you could access the datasets like this:

    alert(datasets[1]);
    // datasets[0] holds the first test data, datasets[1] the second, and so on...
    $.plot($("#placeholder"), datasets[0]);
    

    Your plotSingleCoverage can then be:

    function plotSingleCoverage(dateset){
        $.plot($("#placeholder"), dataset);
    }
    

    And you can use it like this:

    plotSingleCoverage(datasets[0]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text file that I want to edit using Java. It has
I have this html code that i want to edit with jQuery. Here is
My problem: I have Ido-mode enabled and I want to edit (for example) a
I have a view and it's composed of two tables. I want to edit
I have a two dimensional array having elements of a matrix I want to
I want to use nose to test an application that I am writing using
I am hoping someone can help me this this problem. I know how to
EDIT I am still baby in writing Javascript and I need your help in
I'm writing a simple membership application. I have two models, Member and Membership .
I want edit multiple strings at once by selection the list of strings needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.