This commit is contained in:
Matthias 2021-05-24 17:39:32 +02:00
parent fe8e03c666
commit 206bab137b
2 changed files with 47 additions and 42 deletions

View File

@ -129,7 +129,7 @@ the part single price shown is the current price for that supplier part"></i></h
{% for line in price_history %}'{{ line.date }}',{% endfor %}
],
datasets: [{
label: '{% trans "Single Price" %}',
label: '{% blocktrans %}Single Price - {{currency}}{% endblocktrans %}',
backgroundColor: 'rgba(255, 99, 132, 0.2)',
borderColor: 'rgb(255, 99, 132)',
yAxisID: 'y',
@ -141,7 +141,7 @@ the part single price shown is the current price for that supplier part"></i></h
},
{% if 'price_diff' in price_history.0 %}
{
label: '{% trans "Single Price Difference" %}',
label: '{% blocktrans %}Single Price Difference - {{currency}}{% endblocktrans %}',
backgroundColor: 'rgba(68, 157, 68, 0.2)',
borderColor: 'rgb(68, 157, 68)',
yAxisID: 'y2',
@ -152,7 +152,7 @@ the part single price shown is the current price for that supplier part"></i></h
type: 'line'
},
{
label: '{% trans "Part Single Price" %}',
label: '{% blocktrans %}Part Single Price - {{currency}}{% endblocktrans %}',
backgroundColor: 'rgba(70, 127, 155, 0.2)',
borderColor: 'rgb(70, 127, 155)',
yAxisID: 'y',
@ -175,45 +175,7 @@ the part single price shown is the current price for that supplier part"></i></h
}]
}
var ctx = document.getElementById('StockPriceChart');
var StockPriceChart = new Chart(ctx, {
type: 'bar',
data: pricedata,
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {legend: {position: 'bottom'}},
scales: {
y: {
type: 'linear',
position: 'left',
grid: {display: false},
title: {
display: true,
text: '{% blocktrans %}Single Price - {{currency}}{% endblocktrans %}'
}
},
y1: {
type: 'linear',
position: 'right',
grid: {display: false},
titel: {
display: true,
text: '{% trans "Quantity" %}',
position: 'right'
}
},
y2: {
type: 'linear',
position: 'left',
grid: {display: false},
title: {
display: true,
text: '{% blocktrans %}Single Price Difference- {{currency}}{% endblocktrans %}'
}
}
},
}
});
var StockPriceChart = loadStockPricingChart(ctx, pricedata)
{% endif %}
{% endblock %}

View File

@ -688,3 +688,46 @@ function loadPartTestTemplateTable(table, options) {
]
});
}
function loadStockPricingChart(context, data) {
return new Chart(context, {
type: 'bar',
data: data,
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {legend: {position: 'bottom'}},
scales: {
y: {
type: 'linear',
position: 'left',
grid: {display: false},
title: {
display: true,
text: '{% trans "Single Price" %}'
}
},
y1: {
type: 'linear',
position: 'right',
grid: {display: false},
titel: {
display: true,
text: '{% trans "Quantity" %}',
position: 'right'
}
},
y2: {
type: 'linear',
position: 'left',
grid: {display: false},
title: {
display: true,
text: '{% trans "Single Price Difference" %}'
}
}
},
}
});
}