Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Browsable time slider #31

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions examples/upload_file.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
<html>
<head>
<title>Simple Data Grapher</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<script src="https://gitcdn.link/cdn/schme16/Chart.js-RangeSlider/2dc49a0980ca04ca2690bc5f1c9e3644e4207b5a/dist/RangeSlider-all.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="upload_file.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/PapaParse/4.6.3/papaparse.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.3/Chart.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css">
<link href="https://gitcdn.github.io/bootstrap-toggle/2.2.2/css/bootstrap-toggle.min.css" rel="stylesheet">
<script src="https://gitcdn.github.io/bootstrap-toggle/2.2.2/js/bootstrap-toggle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.3/FileSaver.min.js"></script>
<!-- <script src="../src/RangeSlider-all.min.js"></script> -->
<!-- <script src="https://gitcdn.link/cdn/schme16/Chart.js-RangeSlider/677a7eb6c295772606d300697eaf552245e7f171/dist/RangeSlider-all.min.js"></script> -->

<link rel="stylesheet" href="https://gitcdn.link/cdn/schme16/Chart.js-RangeSlider/677a7eb6c295772606d300697eaf552245e7f171/dist/RangeSlider-all.min.css">
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/pretty-checkbox.min.css
"></script> -->

</head>
<body>
Expand Down
32 changes: 18 additions & 14 deletions src/parsing.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,19 @@ function determineConfig(hash,length,type){
config['data']=data;
return config;
}
function plotIt(configuration,graphType,ctx){
new RangeSliderChart({

'chartData': configuration['data'], //The same data you give to Chart.js
'chartOpts': configuration['options'], //Your Chart.js options
'chartType': graphType, //Which Chart.js chart you want (eg. Lie, Bar, Pie, etc.)
'chartCTX': ctx, //your canvas context

'class': 'my-chart-ranger', //Specifies a custom class you want applied to your sliders

'initial': [3, 400] //Which data points to start the sliders on
})
}
function plotGraph(hash,length,type,ci,flag){
if (flag){
console.log("at plotGraph");
Expand All @@ -161,20 +174,11 @@ function plotGraph(hash,length,type,ci,flag){
document.getElementById('canvas_container').appendChild(div);
var ctx = canv.getContext('2d');
var configuration=determineConfig(hash,length,type);
new Chart(ctx, configuration);
$('.carousel').carousel(2);
// saveAsImage();
// new RangeSliderChart({

// chartData: config, //The same data you give to Chart.js
// chartOpts: options, //Your Chart.js options
// chartType: type, //Which Chart.js chart you want (eg. Lie, Bar, Pie, etc.)
// chartCTX: ctx, //your canvas context
var graphType=determineType(type);
console.log(configuration);
window.setTimeout(plotIt(configuration,graphType,ctx),2000);

// class: 'my-chart-ranger', //Specifies a custom class you want applied to your sliders

// initial: [3, 10] //Which data points to start the sliders on
// })
$('.carousel').carousel(2);
}
function afterSampleData(completeData,headers,ci,flag){
console.log("at checkbox");
Expand Down Expand Up @@ -278,7 +282,7 @@ function extractSampleData(completeData,headers){
break;
}
else if (completeData[i][j]!=null || completeData[i][j]!=undefined){
if (typeof(completeData[i][j])=='number'){
if (typeof(completeData[i][j])==='number'){
bool=true;
}
counter+=1;
Expand Down