mirror of
https://github.com/soapingtime/diyhrt.git
synced 2026-09-04 20:10:19 +02:00
[automated] update diyhrt.market
This commit is contained in:
@@ -1 +1,24 @@
|
||||
.stock-chart{table-layout:fixed}.stock-chart tr td.date{height:26px;padding:0;border-bottom:1px solid var(--bs-border-color-translucent)}.stock-chart tr td.date span{position:absolute;height:26px;margin-top:-13px;padding-left:.5rem;font-weight:500;border-left:1px solid var(--bs-card-border-color);overflow:hidden}.stock-chart tr td.day{height:1.9rem;border-bottom:2px solid var(--bs-card-border-color)}
|
||||
.stock-chart {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
.stock-chart tr td.date {
|
||||
height: 26px;
|
||||
padding: 0;
|
||||
border-bottom: 1px solid var(--bs-border-color-translucent);
|
||||
}
|
||||
|
||||
.stock-chart tr td.date span {
|
||||
position: absolute;
|
||||
height: 26px;
|
||||
margin-top: -13px;
|
||||
padding-left: 0.5rem;
|
||||
font-weight: 500;
|
||||
border-left: 1px solid var(--bs-card-border-color);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.stock-chart tr td.day {
|
||||
height: 1.9rem;
|
||||
border-bottom: 2px solid var(--bs-card-border-color);
|
||||
}
|
||||
|
||||
@@ -1,116 +1,3 @@
|
||||
const priceChartElement = document.getElementById("price-chart");
|
||||
const priceChartData = JSON.parse(document.getElementById("pricechart-data").textContent);
|
||||
|
||||
function skipped(ctx, value) {
|
||||
output = !ctx.p0.raw.in_stock ? value : undefined;
|
||||
return output;
|
||||
}
|
||||
|
||||
priceChartData.datasets.forEach(
|
||||
function (dataset) {
|
||||
dataset.segment = {
|
||||
borderColor: ctx => skipped(ctx, "rgba(0, 0, 0, 0)")
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
function afterLabelGen(tooltipItem) {
|
||||
return tooltipItem.raw.state;
|
||||
}
|
||||
|
||||
|
||||
let start_date = new Date();
|
||||
start_date.setDate(start_date.getDate() - 365);
|
||||
|
||||
|
||||
let priceChart = new Chart(
|
||||
priceChartElement,
|
||||
{
|
||||
type: 'line',
|
||||
data: priceChartData,
|
||||
options: {
|
||||
responsive: true,
|
||||
maintainAspectRatio: false,
|
||||
scales: {
|
||||
xAxis: {
|
||||
type: "time",
|
||||
min: start_date,
|
||||
max: new Date(),
|
||||
},
|
||||
yAxis: {
|
||||
}
|
||||
},
|
||||
interaction: {
|
||||
intersect: false,
|
||||
axis: 'xAxis'
|
||||
},
|
||||
plugins: {
|
||||
legend: {
|
||||
labels: {
|
||||
// This more specific font property overrides the global property
|
||||
font: {
|
||||
family: '"Nunito Sans", Cambria, "Times New Roman", Times, serif',
|
||||
size: 16
|
||||
}
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
callbacks: {
|
||||
afterLabel: afterLabelGen,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
const actions = [
|
||||
{
|
||||
name: 'Step: false (default)',
|
||||
handler: (chart) => {
|
||||
chart.data.datasets.forEach(dataset => {
|
||||
dataset.stepped = false;
|
||||
});
|
||||
chart.update();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Step: true',
|
||||
handler: (chart) => {
|
||||
chart.data.datasets.forEach(dataset => {
|
||||
dataset.stepped = true;
|
||||
});
|
||||
chart.update();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Step: before',
|
||||
handler: (chart) => {
|
||||
chart.data.datasets.forEach(dataset => {
|
||||
dataset.stepped = 'before';
|
||||
});
|
||||
chart.update();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Step: after',
|
||||
handler: (chart) => {
|
||||
chart.data.datasets.forEach(dataset => {
|
||||
dataset.stepped = 'after';
|
||||
});
|
||||
chart.update();
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'Step: middle',
|
||||
handler: (chart) => {
|
||||
chart.data.datasets.forEach(dataset => {
|
||||
dataset.stepped = 'middle';
|
||||
});
|
||||
chart.update();
|
||||
}
|
||||
}
|
||||
];
|
||||
const priceChartElement=document.getElementById("price-chart");const priceChartData=JSON.parse(document.getElementById("pricechart-data").textContent);function skipped(ctx,value){output=!ctx.p0.raw.in_stock?value:undefined;return output;}
|
||||
priceChartData.datasets.forEach(function(dataset){dataset.segment={borderColor:ctx=>skipped(ctx,"rgba(0, 0, 0, 0)")}});function afterLabelGen(tooltipItem){return tooltipItem.raw.state;}
|
||||
let start_date=new Date();start_date.setDate(start_date.getDate()-365);let priceChart=new Chart(priceChartElement,{type:'line',data:priceChartData,options:{responsive:true,maintainAspectRatio:false,scales:{xAxis:{type:"time",min:start_date,max:new Date(),},yAxis:{}},interaction:{intersect:false,axis:'xAxis'},plugins:{legend:{labels:{font:{family:'"Nunito Sans", Cambria, "Times New Roman", Times, serif',size:16}}},tooltip:{callbacks:{afterLabel:afterLabelGen,}}},}});const actions=[{name:'Step: false (default)',handler:(chart)=>{chart.data.datasets.forEach(dataset=>{dataset.stepped=false;});chart.update();}},{name:'Step: true',handler:(chart)=>{chart.data.datasets.forEach(dataset=>{dataset.stepped=true;});chart.update();}},{name:'Step: before',handler:(chart)=>{chart.data.datasets.forEach(dataset=>{dataset.stepped='before';});chart.update();}},{name:'Step: after',handler:(chart)=>{chart.data.datasets.forEach(dataset=>{dataset.stepped='after';});chart.update();}},{name:'Step: middle',handler:(chart)=>{chart.data.datasets.forEach(dataset=>{dataset.stepped='middle';});chart.update();}}];
|
||||
Reference in New Issue
Block a user