charts comparison(d3.js,kendo,highcharts,echart,flot,gRaphael,fusioncharts,chart.js) (v2)

Revision 2 of this benchmark created by wayou on


Preparation HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>


<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/graphael/0.5.1/g.raphael-min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/Chart.js/0.2.0/Chart.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/flot/0.8.2/jquery.flot.min.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.8/d3.min.js"></script>

<script src="http://cdn.kendostatic.com/2013.1.319/js/kendo.all.min.js"></script>

<script type="text/javascript" src="http://yourjavascript.com/2173541171/echarts-plain.js"></script>


<script type="text/javascript" src="http://yourjavascript.com/1434737516/fusioncharts.js"></script>
<script type="text/javascript" src="http://yourjavascript.com/1643405713/fusioncharts-charts.js"></script>
<script type="text/javascript" src="http://yourjavascript.com/7712153340/fusioncharts-theme-fint.js"></script>

<div id="highcharts"></div>
<div id="kendo"></div>
<svg id="d3"></svg>
<div id="echart" style="height:400px"></div>

<div id="flot"></div>
<div id="gRaphael"></div>
<div id="fusioncharts"></div>
<canvas id="chartjs" width="900" height="500"></canvas>

Setup

var data = [{
    name: 'Year 1800',
    data: [107, 31, 635, 203, 2]
  }, {
    name: 'Year 1900',
    data: [133, 156, 947, 408, 6]
  }, {
    name: 'Year 2008',
    data: [973, 914, 4054, 732, 34]
  }];

Test runner

Ready to run.

Testing in
TestOps/sec
kendo ui
//code for kendo 
$("#kendo").kendoChart({
  title: {
    text: "Historic World Population by Region"
  },
  legend: {
    position: "top"
  },
  seriesDefaults: {
    type: "bar"
  },
  series: data.reverse(),
  valueAxis: {
    labels: {
      format: "{0}%"
    },
    line: {
      visible: false
    },
    axisCrossingValue: 0
  },
  categoryAxis: {
    categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
    line: {
      visible: false
    },
    labels: {
      padding: {
        top: 0
      }
    }
  },
  tooltip: {
    visible: true,
    format: "{0}%",
    template: "#= series.name #: #= value #"
  }
});
ready
d3.js
//code for d3

var data = [{
  "State": "CA",
  "Under 5 Years": 2704659,
  "5 to 13 Years": 4499890,
  "14 to 17 Years": 2159981,
  "18 to 24 Years": 3853788,
  "25 to 44 Years": 10604510,
  "45 to 64 Years": 8819342,
  "65 Years and Over": 4114496
}, {
  "State": "TX",
  "Under 5 Years": 2027307,
  "5 to 13 Years": 3277946,
  "14 to 17 Years": 1420518,
  "18 to 24 Years": 2454721,
  "25 to 44 Years": 7017731,
  "45 to 64 Years": 5656528,
  "65 Years and Over": 2472223
}, {
  "State": "NY",
  "Under 5 Years": 1208495,
  "5 to 13 Years": 2141490,
  "14 to 17 Years": 1058031,
  "18 to 24 Years": 1999120,
  "25 to 44 Years": 5355235,
  "45 to 64 Years": 5120254,
  "65 Years and Over": 2607672
}, {
  "State": "FL",
  "Under 5 Years": 1140516,
  "5 to 13 Years": 1938695,
  "14 to 17 Years": 925060,
  "18 to 24 Years": 1607297,
  "25 to 44 Years": 4782119,
  "45 to 64 Years": 4746856,
  "65 Years and Over": 3187797
}, {
  "State": "IL",
  "Under 5 Years": 894368,
  "5 to 13 Years": 1558919,
  "14 to 17 Years": 725973,
  "18 to 24 Years": 1311479,
  "25 to 44 Years": 3596343,
  "45 to 64 Years": 3239173,
  "65 Years and Over": 1575308
}, {
  "State": "PA",
  "Under 5 Years": 737462,
  "5 to 13 Years": 1345341,
  "14 to 17 Years": 679201,
  "18 to 24 Years": 1203944,
  "25 to 44 Years": 3157759,
  "45 to 64 Years": 3414001,
  "65 Years and Over": 1910571
}];

var margin = {
  top: 20,
  right: 20,
  bottom: 30,
  left: 40
},
  width = 960 - margin.left - margin.right,
  height = 500 - margin.top - margin.bottom;

var x0 = d3.scale.ordinal()
  .rangeRoundBands([0, width], .1);

var x1 = d3.scale.ordinal();

var y = d3.scale.linear()
  .range([height, 0]);

var color = d3.scale.ordinal()
  .range(["#98abc5", "#8a89a6", "#7b6888", "#6b486b", "#a05d56", "#d0743c", "#ff8c00"]);

var xAxis = d3.svg.axis()
  .scale(x0)
  .orient("bottom");

var yAxis = d3.svg.axis()
  .scale(y)
  .orient("left")
  .tickFormat(d3.format(".2s"));

var svg = d3.select("#d3")
  .attr("width", width + margin.left + margin.right)
  .attr("height", height + margin.top + margin.bottom)
  .append("g")
  .attr("transform", "translate(" + margin.left + "," + margin.top + ")");

//d3 stuff
var ageNames = d3.keys(data[0]).filter(function(key) {
  return key !== "State";
});

data.forEach(function(d) {
  d.ages = ageNames.map(function(name) {
    return {
      name: name,
      value: +d[name]
    };
  });
});

x0.domain(data.map(function(d) {
  return d.State;
}));
x1.domain(ageNames).rangeRoundBands([0, x0.rangeBand()]);
y.domain([0, d3.max(data, function(d) {
  return d3.max(d.ages, function(d) {
    return d.value;
  });
})]);

svg.append("g")
  .attr("class", "x axis")
  .attr("transform", "translate(0," + height + ")")
  .call(xAxis);

svg.append("g")
  .attr("class", "y axis")
  .call(yAxis)
  .append("text")
  .attr("transform", "rotate(-90)")
  .attr("y", 6)
  .attr("dy", ".71em")
  .style("text-anchor", "end")
  .text("Population");

var state = svg.selectAll(".state")
  .data(data)
  .enter().append("g")
  .attr("class", "g")
  .attr("transform", function(d) {
    return "translate(" + x0(d.State) + ",0)";
  });

state.selectAll("rect")
  .data(function(d) {
    return d.ages;
  })
  .enter().append("rect")
  .attr("width", x1.rangeBand())
  .attr("x", function(d) {
    return x1(d.name);
  })
  .attr("y", function(d) {
    return y(d.value);
  })
  .attr("height", function(d) {
    return height - y(d.value);
  })
  .style("fill", function(d) {
    return color(d.name);
  });

var legend = svg.selectAll(".legend")
  .data(ageNames.slice().reverse())
  .enter().append("g")
  .attr("class", "legend")
  .attr("transform", function(d, i) {
    return "translate(0," + i * 20 + ")";
  });

legend.append("rect")
  .attr("x", width - 18)
  .attr("width", 18)
  .attr("height", 18)
  .style("fill", color);

legend.append("text")
  .attr("x", width - 24)
  .attr("y", 9)
  .attr("dy", ".35em")
  .style("text-anchor", "end")
  .text(function(d) {
    return d;
  });
ready
echart
//code for echart
var option = {
  title: {
    text: 'Historic World Population by Region',
    subtext: ''
  },
  tooltip: {
    trigger: 'axis'
  },
  legend: {
    data: ['Year 1800', 'Year 1900', 'Year 2008']
  },
  toolbox: {
    show: true,
    feature: {
      mark: {
        show: true
      },
      dataView: {
        show: true,
        readOnly: false
      },
      magicType: {
        show: true,
        type: ['line', 'bar']
      },
      restore: {
        show: true
      },
      saveAsImage: {
        show: true
      }
    }
  },
  calculable: true,
  xAxis: [{
    type: 'value',
    boundaryGap: [0, 0.01]
  }],
  yAxis: [{
    type: 'category',
    data: ["Oceania", "Europe", "Asia", "America", "Africa"]
  }],
  series: [{
    name: 'Year 1800',
    type: 'bar',
    data: [107, 31, 635, 203, 2].reverse()
  }, {
    name: 'Year 1900',
    type: 'bar',
    data: [133, 156, 947, 408, 6].reverse()
  }, {
    name: 'Year 2008',
    type: 'bar',
    data: [973, 914, 4054, 732, 34].reverse()
  }]
};


var myChart = echarts.init(document.getElementById('echart'));

myChart.setOption(option);
ready
flot
//
ready
gRaphael
//
ready
fusioncharts
//code fusioncharts
var revenueChart = new FusionCharts({
  type: 'msbar2d',
  renderAt: 'fusioncharts',
  width: '900',
  height: '400',
  dataFormat: 'json',
  dataSource: {
    "chart": {
      "caption": "Historic World Population by Region",
      "subCaption": "",
      "xAxisname": "year",
      "yAxisName": "population",
      "numberPrefix": "$",
      "theme": "fint",
      //Cosmetics for legend
      "legendBgColor": "#CCCCCC",
      "legendBgAlpha": "20",
      "legendBorderColor": "#666666",
      "legendBorderThickness": "1",
      "legendBorderAlpha": "40",
      "legendShadow": "1"
    },
    "categories": [{
      "category": [{
        "label": "Africa"
      }, {
        "label": "America"
      }, {
        "label": "Asia"
      }, {
        "label": "Europe"
      }, {
        "label": "Oceania"
      }]
    }],
    "dataset": [{
      "seriesname": "Year 1800",
      "data": [{
        "value": "107"
      }, {
        "value": "31"
      }, {
        "value": "635"
      }, {
        "value": "203"
      }, {
        "value": "2"
      }]
    }, {

      "seriesname": "Year 1900",
      "data": [{
        "value": "133"
      }, {
        "value": "156"
      }, {
        "value": "947"
      }, {
        "value": "408"
      }, {
        "value": "6"
      }]
    }, {

      "seriesname": "Year 2008",
      "data": [{
        "value": "937"
      }, {
        "value": "914"
      }, {
        "value": "4054"
      }, {
        "value": "732"
      }, {
        "value": "34"
      }]
    }].reverse()
  }
}).render();
ready
chart.js
//code for chartjs

var ctx = $("#chartjs").get(0).getContext("2d");
var chartjsdata = {
  labels: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
  datasets: [{
    label: 'Year 1900',
    fillColor: "rgba(220,220,220,0.5)",
    strokeColor: "rgba(220,220,220,0.8)",
    highlightFill: "rgba(220,220,220,0.75)",
    highlightStroke: "rgba(220,220,220,1)",
    data: [107, 31, 635, 203, 2]
  }, {
    label: 'Year 1900',
    fillColor: "rgba(151,187,205,0.5)",
    strokeColor: "rgba(151,187,205,0.8)",
    highlightFill: "rgba(151,187,205,0.75)",
    highlightStroke: "rgba(151,187,205,1)",
    data: [133, 156, 947, 408, 6]
  }, {
    label: 'Year 2008',
    fillColor: "rgba(151,187,205,0.5)",
    strokeColor: "rgba(151,187,205,0.8)",
    highlightFill: "rgba(151,187,205,0.75)",
    highlightStroke: "rgba(151,187,205,1)",
    data: [973, 914, 4054, 732, 34]
  }]
};
var myBarChart = new Chart(ctx).Bar(chartjsdata);
ready
highcharts
//code for highcharts
$('#highcharts').highcharts({
  chart: {
    type: 'bar'
  },
  title: {
    text: 'Historic World Population by Region'
  },
  subtitle: {
    text: 'Source: Wikipedia.org'
  },
  xAxis: {
    categories: ['Africa', 'America', 'Asia', 'Europe', 'Oceania'],
    title: {
      text: null
    }
  },
  yAxis: {
    min: 0,
    title: {
      text: 'Population (millions)',
      align: 'high'
    },
    labels: {
      overflow: 'justify'
    }
  },
  tooltip: {
    valueSuffix: ' millions'
  },
  plotOptions: {
    bar: {
      dataLabels: {
        enabled: true
      }
    }
  },
  legend: {
    layout: 'vertical',
    align: 'right',
    verticalAlign: 'top',
    x: -40,
    y: 100,
    floating: true,
    borderWidth: 1,
    backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor || '#FFFFFF'),
    shadow: true
  },
  credits: {
    enabled: false
  },
  series: data
});
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by charts comparison(d3.js,kendo,highcharts,echart,flot,gRaphael,fusioncharts,chart.js) on
  • Revision 2: published by wayou on
  • Revision 3: published by wayou on
  • Revision 4: published by jqplot test on
  • Revision 5: published on
  • Revision 6: published on
  • Revision 7: published on