From faf5d67b9046d1d52dac9873bdeed9ec961c085c Mon Sep 17 00:00:00 2001 From: Takayuki MATSUOKA Date: Fri, 3 Apr 2015 06:17:29 +0900 Subject: Replace chartselector by Bootstrap's tab. js/bootstrap-patch.css is copied from the following answer on SO : http://stackoverflow.com/a/23267110/2132223 --- ...chmark-silesia-1000mbps-offline-compression.csv | 2 +- csv/benchmark-silesia-1000mbps.csv | 2 +- js/bootstrap-patch.css | 13 ++++ js/chartselector.js | 57 ----------------- js/rendercharts.js | 4 +- test.html | 74 ++++++++++++---------- 6 files changed, 56 insertions(+), 96 deletions(-) create mode 100644 js/bootstrap-patch.css delete mode 100644 js/chartselector.js diff --git a/csv/benchmark-silesia-1000mbps-offline-compression.csv b/csv/benchmark-silesia-1000mbps-offline-compression.csv index e2df4ca..323bca6 100644 --- a/csv/benchmark-silesia-1000mbps-offline-compression.csv +++ b/csv/benchmark-silesia-1000mbps-offline-compression.csv @@ -1,4 +1,4 @@ -"Compressor:string" ,"Compression:number" ,"Decompression:number" ,"Transfer:number" +"Compressor:string" ,"Compression:number" ,"Decompression:number" ,"Transfer:number" LZ4 (r101) -1 , 0.0000 , 0.1165 , 1.0170 LZO-2.06 , 0.0000 , 0.3532 , 1.0064 QuickLZ 1.5.1b6 , 0.0000 , 0.5046 , 0.94743 diff --git a/csv/benchmark-silesia-1000mbps.csv b/csv/benchmark-silesia-1000mbps.csv index 28926f5..265beb2 100644 --- a/csv/benchmark-silesia-1000mbps.csv +++ b/csv/benchmark-silesia-1000mbps.csv @@ -1,4 +1,4 @@ -"Compressor:string","Compression:number","Decompression:number","Transfer:number" +"Compressor:string","Compression:number","Decompression:number","Transfer:number" LZ4 (r101) -1 , 0.5022 , 0.1165 , 1.0170 LZO-2.06 , 0.5119 , 0.3532 , 1.0064 QuickLZ 1.5.1b6 , 0.5682 , 0.5046 , 0.94743 diff --git a/js/bootstrap-patch.css b/js/bootstrap-patch.css new file mode 100644 index 0000000..db40801 --- /dev/null +++ b/js/bootstrap-patch.css @@ -0,0 +1,13 @@ +/* bootstrap hack: fix content width inside hidden tabs + http://stackoverflow.com/a/23267110/2132223 + */ +.tab-content > .tab-pane, +.pill-content > .pill-pane { + display: block !important; /* undo display:none */ + height: 0; /* height:0 is also invisible */ + overflow-y: hidden; /* no-overflow */ +} +.tab-content > .active, +.pill-content > .active { + height: auto; /* let the content decide it */ +} /* bootstrap hack end */ diff --git a/js/chartselector.js b/js/chartselector.js deleted file mode 100644 index 67c81aa..0000000 --- a/js/chartselector.js +++ /dev/null @@ -1,57 +0,0 @@ -/* -Usage: - -Add data-chartselector-chart-id="YOUR-CHART-ID" as buttons attibute. - - - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ~~~~~~~~~~~~ - - - ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ~~~~~~~~~~~~ - -Create parent
as chart group and child
as chart entity. - -
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -
- ~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -
- ~~~~~~~~~~~~ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -
-*/ -(function($) { - $(document).ready(function() { - $("button[data-chartselector-chart-id]").click(function() { - var chartId = $(this).attr("data-chartselector-chart-id"); - showChart(chartId); - }); - }); - - function showChart(chartId) { - var e = $("#" + chartId); - var p = e.closest(".chartselector-group"); - var divs = p.children(".chartselector-chart"); - divs.each(function() { - if(this.id == chartId) { - $(this).css("display", "block"); - $(this).css("visibility", "visible"); - } else { - $(this).css("display", "none"); - } - }); - } - - var cssStyleText = '\ - .chartselector-group { \ - position: relative; \ - } \ - \ - .chartselector-chart { \ - position: absolute; \ - width: 100%; \ - height: 100%; \ - } \ - '; - - $("