Permalink
Browse files

More charts perf tests.

  • Loading branch information...
1 parent e745241 commit f0465667200c7e394322f957ae1deefdaa0ce630 @tripp tripp committed Nov 5, 2012
Showing with 2,695 additions and 0 deletions.
  1. +91 −0 src/charts/tests/perf/perfareaseries-benchmark.js
  2. +109 −0 src/charts/tests/perf/perfareaseries.html
  3. +92 −0 src/charts/tests/perf/perfareaseriesgroup-benchmark.js
  4. +109 −0 src/charts/tests/perf/perfareaseriesgroup.html
  5. +25 −0 src/charts/tests/perf/perfbar-benchmark.js
  6. +109 −0 src/charts/tests/perf/perfbar.html
  7. +26 −0 src/charts/tests/perf/perfbargroup-benchmark.js
  8. +109 −0 src/charts/tests/perf/perfbargroup.html
  9. +95 −0 src/charts/tests/perf/perfbarseries-benchmark.js
  10. +109 −0 src/charts/tests/perf/perfbarseries.html
  11. +96 −0 src/charts/tests/perf/perfbarseriesgroup-benchmark.js
  12. +109 −0 src/charts/tests/perf/perfbarseriesgroup.html
  13. +97 −0 src/charts/tests/perf/perfcolumnseries-benchmark.js
  14. +109 −0 src/charts/tests/perf/perfcolumnseries.html
  15. +98 −0 src/charts/tests/perf/perfcolumnseriesgroup-benchmark.js
  16. +109 −0 src/charts/tests/perf/perfcolumnseriesgroup.html
  17. +91 −0 src/charts/tests/perf/perfcomboseries-benchmark.js
  18. +109 −0 src/charts/tests/perf/perfcomboseries.html
  19. +92 −0 src/charts/tests/perf/perfcomboseriesgroup-benchmark.js
  20. +109 −0 src/charts/tests/perf/perfcomboseriesgroup.html
  21. +91 −0 src/charts/tests/perf/perflineseries-benchmark.js
  22. +109 −0 src/charts/tests/perf/perflineseries.html
  23. +92 −0 src/charts/tests/perf/perflineseriesgroup-benchmark.js
  24. +109 −0 src/charts/tests/perf/perflineseriesgroup.html
  25. +91 −0 src/charts/tests/perf/perfmarkerseries-benchmark.js
  26. +109 −0 src/charts/tests/perf/perfmarkerseries.html
  27. +92 −0 src/charts/tests/perf/perfmarkerseriesgroup-benchmark.js
  28. +109 −0 src/charts/tests/perf/perfmarkerseriesgroup.html
@@ -0,0 +1,91 @@
+YUI.add('perfareaseries-benchmark', function (Y) {
+ Y.BenchmarkSuite = new Benchmark.Suite();
+ var suite = Y.BenchmarkSuite,
+ container,
+ graphic,
+ mockChart,
+ mockGraph,
+ xAxis,
+ yAxis,
+ dataProvider = Y.GeneratePerfTestDataProvider.getData(),
+ seriesObject,
+ seriesKeys = ["expenses", "revenue"];
+ container = document.createElement('div');
+ container.style.left = "10px";
+ container.style.top = "10px";
+ container.style.width = "600px";
+ container.style.height = "300px";
+ container.id = "container";
+ document.body.appendChild(container);
+
+ suite.add("PerfAreaSeries", function() {
+ var i,
+ key,
+ series,
+ len = seriesKeys.length;
+ seriesObject = {};
+ for(i = 0; i < len; i = i + 1)
+ {
+ key = seriesKeys[i];
+ series = new Y.AreaSeries({
+ graphOrder: i,
+ xAxis: xAxis,
+ yAxis: yAxis,
+ graph: mockGraph,
+ xKey: "date",
+ yKey: key
+ });
+ series.render();
+ seriesObject[key] = series;
+ }
+ graphic._redraw();
+ for(key in seriesObject)
+ {
+ if(seriesObject.hasOwnProperty(key))
+ {
+ seriesObject[key].destroy(true);
+ }
+ }
+ }, {
+ onStart: function() {
+ xAxis = new Y.TimeAxis({
+ dataProvider: dataProvider,
+ keys: ["date"],
+ position: "none"
+ });
+ yAxis = new Y.NumericAxis({
+ dataProvider: dataProvider,
+ keys: ["expenses", "revenue"],
+ position: "none"
+ });
+ mockGraph = {};
+ graphic = new Y.Graphic({
+ render: container
+ });
+ mockChart = {};
+ mockChart.get = function(attr) {
+ var val = "yuichart";
+ return val;
+ };
+ mockGraph.get = function(attr) {
+ var val;
+ switch(attr) {
+ case "width" :
+ val = 600;
+ break;
+ case "height" :
+ val = 300;
+ break;
+ case "graphic" :
+ val = graphic;
+ break;
+ case "chart" :
+ val = mockChart;
+ break;
+ }
+ return val;
+ };
+ }
+ });
+
+}, '@VERSION@', {requires: ['charts']});
@@ -0,0 +1,109 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset='utf-8'>
+ <applet code="../../../common/tests/perf/nano.jar" archive="../../../common/tests/perf/nano.jar" style="display: none;"></applet>
+ <script type='text/javascript' src="../../../common/tests/perf/benchmark.js"></script>
+ <script src="../../../../build/yui/yui.js"></script>
+ <script type="text/javascript" src="js/generatedataprovider.js"></script>
+ <script src="../../../common/tests/perf/multi.js"></script>
+ <script src="perfareaseries-benchmark.js"></script>
+ </head>
+
+ <body class='yui3-skin-sam'>
+
+ <p><button id="start">Start Benchmarks against Local YUI</button></p>
+ <p><button id="iframe-start" disabled='true'>Start Benchmarks against YUI3.7.3</button></p>
+ <div id="log"></div>
+ <script>
+
+ YUI({
+ 'generate-dataprovider': {
+ fullpath: 'js/generatedataprovider.js'
+ },
+ 'multi': {
+ fullpath: '../../../common/tests/perf/multi.js',
+ requires: ['event-custom']
+ },
+ 'perfareaseries-benchmark': {
+ fullpath: 'perfareaseries-benchmark.js',
+ requires: ['charts']
+ },
+ 'skin-sam-test-console': {
+ fullpath: '../../../common/tests/assets/test-console.css',
+ type : 'css'
+ },
+ 'test-console': {
+ fullpath : '../../../common/tests/assets/test-console.js',
+ requires : ['console-filters'],
+ skinnable: true
+ },
+ defaultGraphicEngine: (window.location.search.match(/[?&]defaultGraphicEngine=([^&]+)/) || [])[1] || 'svg',
+ filter: (window.location.search.match(/[?&]filter=([^&]+)/) || [])[1] || 'raw',
+ useBrowserConsole: false
+ }).use('generate-dataprovider', 'charts', 'multi', 'perfareaseries-benchmark', 'skin-sam-test-console', 'test-console', function (Y) {
+
+ new Y.Console().render('#log');
+
+
+ var suite = Y.BenchmarkSuite,
+ start = Y.one('#start'),
+ iframeStart = Y.one("#iframe-start"),
+ iY;
+
+ var multi = new Y.Multi({
+ seeds: {
+ Y_373: {
+ test: 'perfareaseries-benchmark',
+ url: 'http://yui.yahooapis.com/3.7.3/build/yui/yui.js',
+ dependencies: 'js/generatedataprovider.js',
+ use: ['charts', 'generate-dataprovider', 'perfareaseries-benchmark']
+ }
+ }
+ });
+
+ multi.on('ready', function () {
+ iframeStart.set('disabled', false);
+ iY = multi.Y_373;
+ });
+
+ suite.on('start', function () {
+ Y.log('Starting benchmarks on local YUI.');
+ });
+
+ suite.on('cycle', function (ev) {
+ Y.log(String(ev.target));
+ });
+
+ suite.on('complete', function () {
+ start.set('disabled', false);
+ Y.log('Finished benchmarks on local YUI.');
+ });
+
+ start.on('click', function () {
+ suite.run({async:true});
+ });
+
+ iframeStart.on('click', function () {
+ var suite = iY.BenchmarkSuite;
+ suite.on('start', function () {
+ Y.log('Starting benchmarks on old YUI.');
+ });
+
+ suite.on('cycle', function (ev) {
+ Y.log(String(ev.target));
+ });
+
+ suite.on('complete', function () {
+ Y.log('Finished benchmarks on old YUI.');
+ });
+
+ suite.run({async:true});
+
+ })
+ });
+
+
+ </script>
+ </body>
+</html>
@@ -0,0 +1,92 @@
+YUI.add('perfareaseriesgroup-benchmark', function (Y) {
+ Y.BenchmarkSuite = new Benchmark.Suite();
+ var suite = Y.BenchmarkSuite,
+ container,
+ graphic,
+ mockChart,
+ mockGraph,
+ xAxis,
+ yAxis,
+ dataProvider = Y.GeneratePerfTestDataProvider.getData(),
+ seriesObject,
+ seriesKeys = ["expenses", "revenue"];
+ container = document.createElement('div');
+ container.style.left = "10px";
+ container.style.top = "10px";
+ container.style.width = "600px";
+ container.style.height = "300px";
+ container.id = "container";
+ document.body.appendChild(container);
+
+ suite.add("PerfAreaSeriesGroup", function() {
+ var i,
+ key,
+ series,
+ len = seriesKeys.length;
+ seriesObject = {};
+ for(i = 0; i < len; i = i + 1)
+ {
+ key = seriesKeys[i];
+ series = new Y.AreaSeries({
+ graphOrder: i,
+ groupMarkers: true,
+ xAxis: xAxis,
+ yAxis: yAxis,
+ graph: mockGraph,
+ xKey: "date",
+ yKey: key
+ });
+ series.render();
+ seriesObject[key] = series;
+ }
+ graphic._redraw();
+ for(key in seriesObject)
+ {
+ if(seriesObject.hasOwnProperty(key))
+ {
+ seriesObject[key].destroy(true);
+ }
+ }
+ }, {
+ onStart: function() {
+ xAxis = new Y.TimeAxis({
+ dataProvider: dataProvider,
+ keys: ["date"],
+ position: "none"
+ });
+ yAxis = new Y.NumericAxis({
+ dataProvider: dataProvider,
+ keys: ["expenses", "revenue"],
+ position: "none"
+ });
+ mockGraph = {};
+ graphic = new Y.Graphic({
+ render: container
+ });
+ mockChart = {};
+ mockChart.get = function(attr) {
+ var val = "yuichart";
+ return val;
+ };
+ mockGraph.get = function(attr) {
+ var val;
+ switch(attr) {
+ case "width" :
+ val = 600;
+ break;
+ case "height" :
+ val = 300;
+ break;
+ case "graphic" :
+ val = graphic;
+ break;
+ case "chart" :
+ val = mockChart;
+ break;
+ }
+ return val;
+ };
+ }
+ });
+
+}, '@VERSION@', {requires: ['charts']});
Oops, something went wrong.

0 comments on commit f046566

Please sign in to comment.