score:1

Accepted answer

Easiest way seems to tag them B=true for both, L=false for lower. Have amended the fiddle to incorporate the following changes and additions.

var B=true;  //draw in both main and other
var L=false; //draw in other only
var data = [

    [2,2, L],
    [3,3, B],
    [4,4, L],
    [5, 4, L],
    [5.5, 5, L],
    [6, 6, B],
    [6, 7, L],
    [7,8, L],
    [7,9, L],
    [8,10, B],
    [8,11, L]

];

and these

var filteredData=[];
for(var i=0; i<data.length; i++) {
    if(data[i][2]) {
        filteredData.push(data[i]);
    }
}

drawGraph(main, false, filteredData);
drawGraph(other, true, data);

function drawGraph(element, drawLine, data) {

        *//rest of function unchanged*

I am not familiar with D3 so did filtering before D3 used. Hope this helps


Related Query