
xData=[0,1,2,3,4,5,6,7,8,9,10];

const s0 =document.getElementById("slid0");
const s1 =document.getElementById("slid1");
const s2 =document.getElementById("slid2");
const s3 =document.getElementById("slid3");
const s4 =document.getElementById("slid4");
const s5 =document.getElementById("slid5");
const s6 =document.getElementById("slid6");
const s7 =document.getElementById("slid7");
const s8 =document.getElementById("slid8");
const s9 =document.getElementById("slid9");
const s10 =document.getElementById("slid10");

const IN0= document.getElementById("x00");
const IN1= document.getElementById("x01");
const IN2= document.getElementById("x02");
const IN3= document.getElementById("x03");
const IN4= document.getElementById("x04");
const IN5= document.getElementById("x05");
const IN6= document.getElementById("x06");
const IN7= document.getElementById("x07");
const IN8= document.getElementById("x08");
const IN9= document.getElementById("x09");
const IN10= document.getElementById("x010");

novekoef=document.getElementById("red");
novekoefIn=document.getElementById("redIn");

let Selekt2=10;
let selekt2 = document.getElementById("a");

let I0 =9;
let I1 =8;
let I2 =7;
let I3 =6;
let I4 =5;
let I5 =4;
let I6 =3;
let I7 =2;
let I8 =1;
let I9 =0;
let I10 =-1;

let suma=[];
let coefapro=[];
let xVystup1=[];
let coefapro1=[];
let aproximovanehodnoty = [];
let pk;
let qn;

s0.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S0= Number(event.target.value);
    IN0.value=S0;
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz2();
    novekoeficienty();
});



s1.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S1= Number(event.target.value);
    IN1.value=S1;
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1()
    zobraz2();
    novekoeficienty();
});

s2.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S2= Number(event.target.value);
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    IN2.value=S2;
    zobraz1()
    zobraz2();
    novekoeficienty();
});

s3.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S3= Number(event.target.value);
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    IN3.value=S3;
    zobraz1()
    zobraz2();
    novekoeficienty();
});

s4.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S4= Number(event.target.value);
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    IN4.value=S4;
    zobraz1()
    zobraz2();
    novekoeficienty();
});

s5.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S5= Number(event.target.value);
    IN5.value=S5;
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1()
    zobraz2();
    novekoeficienty();
});

s6.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S6= Number(event.target.value);
    IN6.value=S6;
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz2();
    novekoeficienty();
});


s7.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S7= Number(event.target.value);
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    IN7.value=S7;
    zobraz2();
    novekoeficienty();
});

s8.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S8= Number(event.target.value);
    IN8.value=S8;
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz2();
    novekoeficienty();
});

s9.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S9= Number(event.target.value);
    IN9.value=S9;
    zobraz1();
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz2();
    novekoeficienty();
});

s10.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    S10= Number(event.target.value);
    IN10.value=S10;
    zobraz1();
    vytvorVstup();
    document.getElementById('VstupX').innerHTML=xVstup;
    sliderupdate();
    zobraz2();
    novekoeficienty();
});



S0=9;
S1=8;
S2=7;
S3=6;
S4=5;
S5=4;
S6=3;
S7=2;
S8=1;
S9=0;
S10=-1;


var xVstup=[S0,S1,S2,S3,S4,S5,S6,S7,S8,S9,S10];

function vytvorVstup(){

    xVstup[0]=S0;
    xVstup[1]=S1;
    xVstup[2]=S2;
    xVstup[3]=S3;
    xVstup[4]=S4;
    xVstup[5]=S5;
    xVstup[6]=S6;
    xVstup[7]=S7;
    xVstup[8]=S8;
    xVstup[9]=S9;
    xVstup[10]=S10;

    console.log(xVstup)

}



var xVystup=[0,0,0,0,0,0,0,0,0,0,0];


document.getElementById('VstupX').innerHTML=xVstup;
document.getElementById('VystupX').innerHTML=xVystup;
document.getElementById('Vystupcoef1').innerHTML=coefapro;
document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;




function DCT1(){

    const N = xVstup.length;
    let pk;
    xVystup=[];

    for (let k = 0; k < N; k++) {
        let suma = 0;
        for (let n = 0; n < N; n++) {
            let kro1, kro2, kro3, kro4;
            if (n === 0) {
                kro1 = 1;
            } else {
                kro1 = 0;
            }
            if (n === N-1) {
                kro2 = 1;
            } else {
                kro2 = 0;
            }
            if (k === 0) {
                kro3 = 1;
            } else {
                kro3 = 0;
            }
            if (k === N-1) {
                kro4 = 1;
            } else {
                kro4 = 0;
            }
            pk =  Math.sqrt((2 - kro3 - kro4)/(N-1));
            const qn = Math.sqrt(1/ (1 + kro1 + kro2));
            const kosinus = Math.cos((Math.PI*n*k)/(N-1));
            suma +=qn * xVstup[n] * kosinus;

        }

        xVystup[k] = pk*suma;

    }




     xVystup1=[];

    for (let i = 0; i < xVystup.length; i++) {
        xVystup1[i] = xVystup[i].toFixed(3);
    }




    document.getElementById('VystupX').innerHTML=xVystup1;
    document.getElementById('Vystupcoef1').innerHTML=coefapro;
    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;
}

function DCT2(){

    const N = xVstup.length;
    xVystup = [];

    for (let k = 0; k < N; k++) {
        let suma = 0;

        for (let n = 0; n < N; n++) {
            suma += xVstup[n] * Math.cos((Math.PI * (n + 0.5) * k) / N);
        }

        let pk;
        if (k === 0) {
            pk =  Math.sqrt(1/N);
        } else {
            pk = Math.sqrt(2 / N);
        }
        xVystup[k] = pk * suma;
    }

    console.log(xVystup)

    xVystup1=[];

    for (let i = 0; i < xVystup.length; i++) {
        xVystup1[i] = xVystup[i].toFixed(3);
    }
    console.log(xVystup1);

    document.getElementById('VystupX').innerHTML=xVystup1;
    document.getElementById('Vystupcoef1').innerHTML=coefapro;
    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;
}

function DCT3() {

    const N = xVstup.length;
    xVystup = [];
    for (let k = 0; k < N; k++) {
        let suma = 0;

        for (let n = 0; n < N; n++) {

            let kro1;
            if (n === 0) {
                kro1 = 1;
            } else {
                kro1 = 0;
            }

            const qn = Math.sqrt(1/ (1 + kro1));

            suma += qn* xVstup[n] * Math.cos((Math.PI *n* (k+0.5)/N));


        }
        let pk=Math.sqrt(2/N)
        xVystup[k] = pk*suma;
    }

    xVystup1=[];

    for (let i = 0; i < xVystup.length; i++) {
        xVystup1[i] = xVystup[i].toFixed(3);
    }

    console.log(xVystup1);

    document.getElementById('VystupX').innerHTML=xVystup1;
    document.getElementById('Vystupcoef1').innerHTML=coefapro;
    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;
}


function DCT4(){

    const N = xVstup.length;
    xVystup = [];

    for (let k = 0; k < N; k++) {
        let suma = 0;

        for (let n = 0; n < N; n++) {
            suma += xVstup[n] * Math.cos((Math.PI * (n + 0.5) * (k+0.5) / N));
        }

        let pk=Math.sqrt(2/N);

        xVystup[k] = pk * suma;

    }
xVystup=xVystup;

   xVystup1=[];

    for (let i = 0; i < xVystup.length; i++) {
        xVystup1[i] = xVystup[i].toFixed(3);
    }

    console.log(xVystup1);

    document.getElementById('VystupX').innerHTML=xVystup1;
    document.getElementById('Vystupcoef1').innerHTML=coefapro;
    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;
}


DCT1();
IDCT1();

var Selekt1=1;
var selekt = document.getElementById("dctTyp");


selekt.addEventListener('change', function handleChange(event)
{

     Selekt1= Number(event.target.value);


    if (Selekt1 === 1) {

        DCT1();
        IDCT1();


    }
    else if (Selekt1 === 2) {

        DCT2();
        IDCT2();
    }
    else if (Selekt1 === 3) {

        DCT3();
        IDCT3();

    }
    else if (Selekt1 === 4) {

        DCT4();
        IDCT4();

    }
    zobraz2();

});







selekt2.addEventListener('change', function handleChange(event)
{

    Selekt2= Number(event.target.value);
    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;
    novekoeficienty();

    if (Selekt1 === 1) {

        DCT1();
        IDCT1();


    }
    else if (Selekt1 === 2) {

        DCT2();
        IDCT2();
    }
    else if (Selekt1 === 3) {

        DCT3();
        IDCT3();

    }
    else if (Selekt1 === 4) {

        DCT4();
        IDCT4();

    }

});



// Přidání funkce pro eventlistenery slideru

function sliderupdate(){

    if (Selekt1 === 1) {
          DCT1();
          IDCT1();

    }
    else if (Selekt1 === 2) {
        DCT2();
        IDCT2();

    }
    else if  (Selekt1 ===3) {
        DCT3();
        IDCT3();

    }
    else if (Selekt1 === 4) {
        DCT4();
        IDCT4();

    }
}



IN0.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I0 = Number(event.target.value);
    s0.value = I0;
    S0=I0;
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();

    novekoeficienty();
});

IN1.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I1 = Number(event.target.value);
    s1.value = I1;
    S1=I1;
    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();

    novekoeficienty();
});

IN2.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I2 = Number(event.target.value);
    s2.value = I2;
    S2=I2;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});

IN3.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I3 = Number(event.target.value);
    s3.value = I3;
    S3=I3;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});

IN4.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I4 = Number(event.target.value);
    s4.value = I4;
    S4=I4;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});

IN5.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I5 = Number(event.target.value);
    s5.value = I5;
    S5=I5;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});

IN6.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I6 = Number(event.target.value);
    s6.value = I6;
    S6=I6;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});



IN7.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I7 = Number(event.target.value);
    s7.value = I7;
    S7=I7;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});

IN8.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I8 = Number(event.target.value);
    s8.value = I8;
    S8=I8;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});

IN9.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I9 = Number(event.target.value);
    s9.value = I9;
    S9=I9;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});

IN10.addEventListener('input', function handleChange(event) {
    console.log(event.target.value);
    I10 = Number(event.target.value);
    s10.value = I10;
    S10=I10;

    vytvorVstup();
    sliderupdate();
    document.getElementById('VstupX').innerHTML=xVstup;
    zobraz1();
    zobraz2();
    novekoeficienty();
});




let cislo;
let cislo2;





novekoefIn.addEventListener('input', function handleChange(event) {

    cislo = Number(event.target.value);
    novekoef.value = cislo;
    cislo2=cislo;

    if (Selekt1 === 1) {

        DCT1();
        IDCT1();


    }
    else if (Selekt1 === 2) {

        DCT2();
        IDCT2();
    }
    else if (Selekt1 === 3) {

        DCT3();
        IDCT3();

    }
    else if (Selekt1 === 4) {

        DCT4();
        IDCT4();

    }

zobraz2();

});


novekoef.addEventListener('input', function handleChange(event) {

    cislo2 = Number(event.target.value);
    novekoefIn.value = cislo2;
    cislo=cislo2;

    if (Selekt1 === 1) {

        DCT1();
        IDCT1();


    }
    else if (Selekt1 === 2) {

        DCT2();
        IDCT2();
    }
    else if (Selekt1 === 3) {

        DCT3();
        IDCT3();

    }
    else if (Selekt1 === 4) {

        DCT4();
        IDCT4();

    }
zobraz1();
    zobraz2();
});



function novekoeficienty(){

    if (Selekt1 === 1) {

        DCT1();

        zobraz1();

    }
    else if (Selekt1 === 2) {

        DCT2();

        zobraz1();
    }
    else if (Selekt1 === 3) {

        DCT3();

        zobraz1();

    }
    else if (Selekt1 === 4) {

        DCT4();

        zobraz1();

    }


coefapro=[];

console.log(xVystup)


    if (Selekt2 === 10) {
        for (let i = 0; i < xVystup.length; i++) {
            if (xVystup[i] < novekoef.value) {
                coefapro.push(0);
            } else {
                coefapro.push(xVystup[i]);
            }

            for (let i = 0; i < coefapro.length; i++) {
                coefapro1[i] = coefapro[i].toFixed(3);
            }
        }

    } else if (Selekt2 === 11) {
        for (let i = 0; i < xVystup.length; i++) {
            if (xVystup[i] > novekoef.value) {
                coefapro.push(0);
            } else {
                coefapro.push(xVystup[i]);
            }

            for (let i = 0; i < coefapro.length; i++) {
                coefapro1[i] = coefapro[i].toFixed(3);
            }
        }



    }


    console.log(xVystup);
    console.log(coefapro);

    coefapro1=[];

    for (let i = 0; i < coefapro.length; i++) {
        coefapro1.push(parseFloat(coefapro[i]));
    }


    console.log(coefapro1)

    for (let i = 0; i < coefapro1.length; i++) {
        coefapro1[i] = coefapro1[i].toFixed(3);
    }


    document.getElementById('Vystupcoef1').innerHTML=coefapro1;
    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;
    console.log(coefapro1);



}

function IDCT1(){

    novekoeficienty();



    const N = coefapro.length;
    let pk;
    aproximovanehodnoty=[];

    for (let k = 0; k < N; k++) {
        let suma = 0;
        for (let n = 0; n < N; n++) {
            let kro1, kro2, kro3, kro4;
            if (n === 0) {
                kro1 = 1;
            } else {
                kro1 = 0;
            }
            if (n === N-1) {
                kro2 = 1;
            } else {
                kro2 = 0;
            }
            if (k === 0) {
                kro3 = 1;
            } else {
                kro3 = 0;
            }
            if (k === N-1) {
                kro4 = 1;
            } else {
                kro4 = 0;
            }
            pk =  Math.sqrt((2 - kro3 - kro4)/(N-1));
            const qn = Math.sqrt(1/ (1 + kro1 + kro2));
            const kosinus = Math.cos((Math.PI*n*k)/(N-1));
            suma +=qn * coefapro[n] * kosinus;

        }

        aproximovanehodnoty[k] = (pk*suma).toFixed(3);

    }

    console.log(aproximovanehodnoty);
    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;


}





function IDCT2(){

    novekoeficienty();

    const N = coefapro.length;
    aproximovanehodnoty = [];
    for (let k = 0; k < N; k++) {
        let suma = 0;

        for (let n = 0; n < N; n++) {

            let kro1;
            if (n === 0) {
                kro1 = 1;
            } else {
                kro1 = 0;
            }

            const qn = Math.sqrt(1/ (1 + kro1));

            suma += qn* coefapro[n] * Math.cos((Math.PI *n* (k+0.5)/N));


        }
        let pk=Math.sqrt(2/N)
        aproximovanehodnoty[k] = (pk*suma).toFixed(3);
    }


    console.log(aproximovanehodnoty);



    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;

}


function IDCT3(){

 novekoeficienty();

    const N = coefapro.length;
    aproximovanehodnoty = [];

    for (let k = 0; k < N; k++) {
        let suma = 0;

        for (let n = 0; n < N; n++) {
            suma += coefapro[n] * Math.cos((Math.PI * (n + 0.5) * k) / N);
        }

        let pk;
        if (k === 0) {
            pk =  Math.sqrt(1/N);
        } else {
            pk = Math.sqrt(2 / N);
        }
        aproximovanehodnoty[k] = (pk * suma).toFixed(3);
    }


    console.log(aproximovanehodnoty);

    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;

}

function IDCT4(){

    novekoeficienty();

 const N = coefapro.length;
    aproximovanehodnoty = [];

    for (let k = 0; k < N; k++) {
        let suma = 0;

        for (let n = 0; n < N; n++) {
            suma += coefapro[n] * Math.cos((Math.PI * (n + 0.5) * (k+0.5) / N));
        }

        let pk=Math.sqrt(2/N);

        aproximovanehodnoty[k] = (pk * suma).toFixed(3);

    }

    console.log(aproximovanehodnoty);

    document.getElementById('aproximovanehodnoty1').innerHTML=aproximovanehodnoty;

}

function zobraz2() {



    const data2 = [
        [xData[0], xVystup[0]],
        [xData[1], xVystup[1]],
        [xData[2], xVystup[2]],
        [xData[3], xVystup[3]],
        [xData[4], xVystup[4]],
        [xData[5], xVystup[5]],
        [xData[6], xVystup[6]],
        [xData[7], xVystup[7]],
        [xData[8], xVystup[8]],
        [xData[9], xVystup[9]],
        [xData[10], xVystup[10]],
    ];

    const data3 = [
        [xData[0], coefapro1[0]],
        [xData[1], coefapro1[1]],
        [xData[2], coefapro1[2]],
        [xData[3], coefapro1[3]],
        [xData[4], coefapro1[4]],
        [xData[5], coefapro1[5]],
        [xData[6], coefapro1[6]],
        [xData[7], coefapro1[7]],
        [xData[8], coefapro1[8]],
        [xData[9], coefapro1[9]],
        [xData[10], coefapro1[10]],
    ];



    const dataset1 = {
        data: data2,
        label: 'Koeficienty DCT',
        bars: {
            show: true,
            barWidth: 0.2,
        },
        color: 'blue',
    };

    const dataset2 = {
        data: data3,
        label: 'Koeficienty po aproximaci',
        bars: {
            show: true,
            barWidth: 0.3,
        },
        color: 'red',
    };



    const options2 = {
        title:"Koeficienty Kosinové Transformace",
        bars: {
            show: true,
            barWidth: 0.2,
        },

        xaxis: {
            min: -5,
            max: 15,
            ticks:[0,1,2,3,4,5,6,7,8,9,10]
        },


        yaxis: {
            min: -15,
            max: 15,
        },

        series: {
            lines: { show: true },
            points: { show: true },
            color: 'red'
        }



    };

    Flotr.draw(document.getElementById("vystupnihodnoty"), [dataset1,dataset2], options2);







}







function zobraz1() {


    const data = [
        [xData[0], xVstup[0]],
        [xData[1], xVstup[1]],
        [xData[2], xVstup[2]],
        [xData[3], xVstup[3]],
        [xData[4], xVstup[4]],
        [xData[5], xVstup[5]],
        [xData[6], xVstup[6]],
        [xData[7], xVstup[7]],
        [xData[8], xVstup[8]],
        [xData[9], xVstup[9]],
        [xData[10], xVstup[10]],
    ];



    const data0 = [
        [xData[0], aproximovanehodnoty[0]],
        [xData[1], aproximovanehodnoty[1]],
        [xData[2], aproximovanehodnoty[2]],
        [xData[3], aproximovanehodnoty[3]],
        [xData[4], aproximovanehodnoty[4]],
        [xData[5], aproximovanehodnoty[5]],
        [xData[6], aproximovanehodnoty[6]],
        [xData[7], aproximovanehodnoty[7]],
        [xData[8], aproximovanehodnoty[8]],
        [xData[9], aproximovanehodnoty[9]],
        [xData[10], aproximovanehodnoty[10]],
    ];


    const dataset3 = {
        data: data,
        label: 'Vstupní signál',
        bars: {
            show: true,
            barWidth: 0.2,
        },
        color: 'blue',
    };

    const dataset4 = {
        data: data0,
        label: "Aproxmiovaný signál" ,
        bars: {
            show: true,
            barWidth: 0.3,
        },
        color: 'red',
    };




    const options = {
        title:"Vstupní signál",
        bars: {
            show: true,
            barWidth: 0.2,
        },

        xaxis: {
            min: -5,
            max: 15,
            ticks:[0,1,2,3,4,5,6,7,8,9,10]
        },


        yaxis: {
            min: -15,
            max: 15,
        },

        series: {
            lines: { show: true },
            points: { show: true },
            color: 'red'
        }


    };

    Flotr.draw(document.getElementById("vstupnihodnoty"), [dataset3,dataset4], options);

}






zobraz1();
zobraz2();