$(document).ready(function() { myJSON = [{"TXLCode":"GA199010003","OL1":"222.03","OL2":"0","OW1":"222.04","OW2":"0","R11":"0.99","R12":"0.99","R13":"0","R21":"0.99","R22":"0.99","R23":"0","R31":"0.99","R32":"0.99","R33":"0","R41":"0.99","R42":"0.99","R43":"0","Messdatum":"2016-02-12 19:18:12","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA199010004","OL1":"222.04","OL2":"0","OW1":"222.18","OW2":"0","R11":"0.99","R12":"0.99","R13":"0","R21":"0.99","R22":"0.99","R23":"0","R31":"0.99","R32":"0.99","R33":"0","R41":"0.99","R42":"0.99","R43":"0","Messdatum":"2016-02-12 19:19:35","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010289","OL1":"222.11","OL2":"0","OW1":"222.09","OW2":"0","R11":"42.3","R12":"42.3","R13":"0","R21":"42.29","R22":"42.32","R23":"0","R31":"42.29","R32":"42.29","R33":"0","R41":"42.3","R42":"42.27","R43":"0","Messdatum":"2016-07-20 11:29:57","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010290","OL1":"222.09","OL2":"0","OW1":"222.06","OW2":"0","R11":"42.3","R12":"42.3","R13":"0","R21":"42.29","R22":"42.3","R23":"0","R31":"42.3","R32":"42.31","R33":"0","R41":"42.27","R42":"42.28","R43":"0","Messdatum":"2016-07-20 11:32:40","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010291","OL1":"222.1","OL2":"0","OW1":"222.09","OW2":"0","R11":"42.32","R12":"42.29","R13":"0","R21":"42.29","R22":"42.3","R23":"0","R31":"42.3","R32":"42.3","R33":"0","R41":"42.29","R42":"42.27","R43":"0","Messdatum":"2016-07-20 11:34:11","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010292","OL1":"222.1","OL2":"0","OW1":"222.08","OW2":"0","R11":"42.32","R12":"42.32","R13":"0","R21":"42.26","R22":"42.28","R23":"0","R31":"42.3","R32":"42.3","R33":"0","R41":"42.3","R42":"42.29","R43":"0","Messdatum":"2016-07-20 11:35:50","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010293","OL1":"222.11","OL2":"0","OW1":"222.09","OW2":"0","R11":"42.28","R12":"42.3","R13":"0","R21":"42.3","R22":"42.31","R23":"0","R31":"42.32","R32":"42.33","R33":"0","R41":"42.25","R42":"42.26","R43":"0","Messdatum":"2016-07-20 11:46:13","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010294","OL1":"222.09","OL2":"0","OW1":"222.08","OW2":"0","R11":"42.31","R12":"42.32","R13":"0","R21":"42.28","R22":"42.29","R23":"0","R31":"42.33","R32":"42.3","R33":"0","R41":"42.24","R42":"42.25","R43":"0","Messdatum":"2016-07-20 11:48:51","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010295","OL1":"222.11","OL2":"0","OW1":"222.13","OW2":"0","R11":"42.31","R12":"42.33","R13":"0","R21":"42.26","R22":"42.3","R23":"0","R31":"42.29","R32":"42.33","R33":"0","R41":"42.27","R42":"42.27","R43":"0","Messdatum":"2016-07-20 11:52:18","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010296","OL1":"222.11","OL2":"0","OW1":"222.08","OW2":"0","R11":"42.3","R12":"42.31","R13":"0","R21":"42.26","R22":"42.3","R23":"0","R31":"42.32","R32":"42.34","R33":"0","R41":"42.23","R42":"42.23","R43":"0","Messdatum":"2016-07-20 11:54:52","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010297","OL1":"222.09","OL2":"0","OW1":"222.08","OW2":"0","R11":"42.31","R12":"42.32","R13":"0","R21":"42.29","R22":"42.33","R23":"0","R31":"42.32","R32":"42.33","R33":"0","R41":"42.26","R42":"42.27","R43":"0","Messdatum":"2016-07-20 11:56:51","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010298","OL1":"222.09","OL2":"0","OW1":"222.08","OW2":"0","R11":"42.31","R12":"42.32","R13":"0","R21":"42.29","R22":"42.31","R23":"0","R31":"42.32","R32":"42.33","R33":"0","R41":"42.25","R42":"42.27","R43":"0","Messdatum":"2016-07-20 11:58:46","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010299","OL1":"222.09","OL2":"0","OW1":"222.1","OW2":"0","R11":"42.31","R12":"42.29","R13":"0","R21":"42.31","R22":"42.3","R23":"0","R31":"42.32","R32":"42.31","R33":"0","R41":"42.27","R42":"42.27","R43":"0","Messdatum":"2016-07-20 12:00:15","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010300","OL1":"222.08","OL2":"0","OW1":"222.09","OW2":"0","R11":"42.28","R12":"42.29","R13":"0","R21":"42.3","R22":"42.3","R23":"0","R31":"42.33","R32":"42.34","R33":"0","R41":"42.24","R42":"42.25","R43":"0","Messdatum":"2016-07-20 12:01:52","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010301","OL1":"222.07","OL2":"0","OW1":"222.09","OW2":"0","R11":"42.32","R12":"42.31","R13":"0","R21":"42.3","R22":"42.29","R23":"0","R31":"42.29","R32":"42.29","R33":"0","R41":"42.3","R42":"42.28","R43":"0","Messdatum":"2016-07-20 12:03:32","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010302","OL1":"222.09","OL2":"0","OW1":"222.08","OW2":"0","R11":"42.3","R12":"42.3","R13":"0","R21":"42.29","R22":"42.32","R23":"0","R31":"42.26","R32":"42.28","R33":"0","R41":"42.3","R42":"42.3","R43":"0","Messdatum":"2016-07-20 12:05:11","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010303","OL1":"222.1","OL2":"0","OW1":"222.08","OW2":"0","R11":"42.3","R12":"42.32","R13":"0","R21":"42.29","R22":"42.3","R23":"0","R31":"42.26","R32":"42.3","R33":"0","R41":"42.3","R42":"42.32","R43":"0","Messdatum":"2016-07-20 12:08:20","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010304","OL1":"222.12","OL2":"0","OW1":"222.08","OW2":"0","R11":"42.3","R12":"42.31","R13":"0","R21":"42.29","R22":"42.3","R23":"0","R31":"42.31","R32":"42.3","R33":"0","R41":"42.28","R42":"42.29","R43":"0","Messdatum":"2016-07-20 12:10:14","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA102010305","OL1":"222.11","OL2":"0","OW1":"222.11","OW2":"0","R11":"42.32","R12":"42.33","R13":"0","R21":"42.28","R22":"42.28","R23":"0","R31":"42.3","R32":"42.33","R33":"0","R41":"42.24","R42":"42.25","R43":"0","Messdatum":"2016-07-20 12:12:16","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA103010195","OL1":"222.09","OL2":"0","OW1":"222.1","OW2":"0","R11":"42.27","R12":"42.26","R13":"0","R21":"42.31","R22":"42.28","R23":"0","R31":"42.3","R32":"42.28","R33":"0","R41":"42.34","R42":"42.33","R43":"0","Messdatum":"2016-07-20 14:31:15","Rauheitsdatum":"0000-00-00 00:00:00"},{"TXLCode":"GA103010196","OL1":"222.07","OL2":"0","OW1":"222.09","OW2":"0","R11":"42.26","R12":"42.27","R13":"0","R21":"42.27","R22":"42.29","R23":"0","R31":"42.3","R32":"42.32","R33":"0","R41":"42.32","R42":"42.32","R43":"0","Messdatum":"2016-07-20 14:32:25","Rauheitsdatum":"0000-00-00 00:00:00"}]; $('body').off("click", "#btn00"); $('body').off("click", "#btn01"); $('body').off("click", "#btn02"); $('body').off("click", "#btn03"); $('body').on("click", "#btn00", function() { }); $('body').on("click", "#btn01", function() { }); $('body').on("click", "#btn02", function() { }); $('body').on("click", "#btn03", function() { maches(myJSON); }); }); function maches(messwerte){ var my2121JSON=[]; $.each(messwerte, function(i, item) { partNr = item.TXLCode.substring(item.TXLCode.length -4); toolNr = item.TXLCode.substring(3,5); toolpart = toolNr + "-" + partNr; my2121JSON.push({ code: toolpart, OL: Number(item.OL1), OW: Number(item.OW1), min: 222.00, nom: 222.10, max: 222.20 }); }); console.log("$.each() ende"); setTimeout(function () { chart = c3.generate({ data: { json: my2121JSON, keys: { x: 'code', // it's possible to specify 'x' when category axis value: [ 'OL', 'OW', 'min', 'nom', 'max' ], } }, axis: { x: { type: 'category', label: { text: "Outer Length", position: "inner-center" } } }, y2: { inner: true }, color: { pattern: ['violet', 'yellow', 'red', 'green', 'blue'] } }); }, 1250); }