begin date picker
This commit is contained in:
Vendored
+73
-14369
File diff suppressed because it is too large
Load Diff
+33
-9
@@ -1,7 +1,8 @@
|
|||||||
import Chart from 'chart.js/auto';
|
import Chart from 'chart.js/auto';
|
||||||
import { elementOpen, elementClose, elementVoid, text } from 'incremental-dom';
|
import { elementOpen as o, elementClose as c, elementVoid as h, text, patch } from 'incremental-dom';
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
|
|
||||||
|
//const o = elementOpen, c=elementClose, h=elementVoid;
|
||||||
const data = [
|
const data = [
|
||||||
{ year: 2010, count: 10 },
|
{ year: 2010, count: 10 },
|
||||||
{ year: 2011, count: 20 },
|
{ year: 2011, count: 20 },
|
||||||
@@ -12,18 +13,40 @@ const data = [
|
|||||||
{ year: 2016, count: 28 },
|
{ year: 2016, count: 28 },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
function Dates(datesP:Promise<Array<string>>){
|
||||||
|
const el =
|
||||||
|
o('div');
|
||||||
|
text('Loading');
|
||||||
|
c('div');
|
||||||
|
datesP.then(dates=>{
|
||||||
|
patch(el, ()=>{
|
||||||
|
o('select');
|
||||||
|
for(const date of dates){
|
||||||
|
o('option', date);
|
||||||
|
text(date);
|
||||||
|
c('option');
|
||||||
|
}
|
||||||
|
c('select');
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function App({ ticks=[0,1,2,3,4,5] }) {
|
function App({ ticks=[0,1,2,3,4,5] }) {
|
||||||
Header();
|
Header();
|
||||||
elementOpen('div', '', ['class', "chart"]);
|
Dates(fetch('http://127.0.0.1:8234/option_quotes/AAPL/quote_dates').then(x=>x.json()));
|
||||||
|
/*
|
||||||
|
o('div', '', ['class', "chart"]);
|
||||||
ticks.forEach((tick)=>{
|
ticks.forEach((tick)=>{
|
||||||
elementOpen('label'); text(`T_${tick}`); elementClose('label');
|
o('label'); text(`T_${tick}`); c('label');
|
||||||
elementVoid('input', tick, ['type',"range",'min',"0",'max',"100"]);
|
h('input', tick, ['type',"range",'min',"0",'max',"100"]);
|
||||||
});
|
});
|
||||||
elementClose('div');
|
c('div');
|
||||||
elementOpen('div', 'barChartContainer', ['style', 'width:800px;']);
|
*/
|
||||||
elementOpen('canvas', 'barChart', ['id', 'barChart']);
|
/*
|
||||||
elementClose('canvas');
|
o('div', 'barChartContainer', ['style', 'width:800px;']);
|
||||||
elementClose('div');
|
o('canvas', 'barChart', ['id', 'barChart']);
|
||||||
|
c('canvas');
|
||||||
|
c('div');
|
||||||
|
|
||||||
new Chart(//@ts-ignore
|
new Chart(//@ts-ignore
|
||||||
document.getElementById('barChart'),
|
document.getElementById('barChart'),
|
||||||
@@ -40,6 +63,7 @@ function App({ ticks=[0,1,2,3,4,5] }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
Reference in New Issue
Block a user