mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
fix for bom-pricing chart not showing up
This commit is contained in:
parent
5598f7fad1
commit
628e365c6a
@ -332,79 +332,81 @@
|
|||||||
|
|
||||||
// history graphs
|
// history graphs
|
||||||
{% if price_history %}
|
{% if price_history %}
|
||||||
var purchasepricedata = {
|
var purchasepricedata = {
|
||||||
labels: [
|
labels: [
|
||||||
{% for line in price_history %}'{{ line.date }}',{% endfor %}
|
{% for line in price_history %}'{{ line.date }}',{% endfor %}
|
||||||
|
],
|
||||||
|
datasets: [{
|
||||||
|
label: '{% blocktrans %}Single Price - {{currency}}{% endblocktrans %}',
|
||||||
|
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
||||||
|
borderColor: 'rgb(255, 99, 132)',
|
||||||
|
yAxisID: 'y',
|
||||||
|
data: [
|
||||||
|
{% for line in price_history %}{{ line.price|stringformat:".2f" }},{% endfor %}
|
||||||
],
|
],
|
||||||
datasets: [{
|
borderWidth: 1,
|
||||||
label: '{% blocktrans %}Single Price - {{currency}}{% endblocktrans %}',
|
type: 'line'
|
||||||
backgroundColor: 'rgba(255, 99, 132, 0.2)',
|
|
||||||
borderColor: 'rgb(255, 99, 132)',
|
|
||||||
yAxisID: 'y',
|
|
||||||
data: [
|
|
||||||
{% for line in price_history %}{{ line.price|stringformat:".2f" }},{% endfor %}
|
|
||||||
],
|
|
||||||
borderWidth: 1,
|
|
||||||
type: 'line'
|
|
||||||
},
|
|
||||||
{% if 'price_diff' in price_history.0 %}
|
|
||||||
{
|
|
||||||
label: '{% blocktrans %}Single Price Difference - {{currency}}{% endblocktrans %}',
|
|
||||||
backgroundColor: 'rgba(68, 157, 68, 0.2)',
|
|
||||||
borderColor: 'rgb(68, 157, 68)',
|
|
||||||
yAxisID: 'y2',
|
|
||||||
data: [
|
|
||||||
{% for line in price_history %}{{ line.price_diff|stringformat:".2f" }},{% endfor %}
|
|
||||||
],
|
|
||||||
borderWidth: 1,
|
|
||||||
type: 'line',
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '{% blocktrans %}Part Single Price - {{currency}}{% endblocktrans %}',
|
|
||||||
backgroundColor: 'rgba(70, 127, 155, 0.2)',
|
|
||||||
borderColor: 'rgb(70, 127, 155)',
|
|
||||||
yAxisID: 'y',
|
|
||||||
data: [
|
|
||||||
{% for line in price_history %}{{ line.price_part|stringformat:".2f" }},{% endfor %}
|
|
||||||
],
|
|
||||||
borderWidth: 1,
|
|
||||||
type: 'line',
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
{% endif %}
|
|
||||||
{
|
|
||||||
label: '{% trans "Quantity" %}',
|
|
||||||
backgroundColor: 'rgba(255, 206, 86, 0.2)',
|
|
||||||
borderColor: 'rgb(255, 206, 86)',
|
|
||||||
yAxisID: 'y1',
|
|
||||||
data: [
|
|
||||||
{% for line in price_history %}{{ line.qty|stringformat:"f" }},{% endfor %}
|
|
||||||
],
|
|
||||||
borderWidth: 1
|
|
||||||
}]
|
|
||||||
}
|
|
||||||
var StockPriceChart = loadStockPricingChart($('#StockPriceChart'), purchasepricedata)
|
|
||||||
var bom_colors = randomColor({hue: 'green', count: {{ bom_parts|length }} })
|
|
||||||
var bomdata = {
|
|
||||||
labels: [{% for line in bom_parts %}'{{ line.name }}',{% endfor %}],
|
|
||||||
datasets: [
|
|
||||||
{
|
|
||||||
label: 'Price',
|
|
||||||
data: [{% for line in bom_parts %}{{ line.min_price }},{% endfor %}],
|
|
||||||
backgroundColor: bom_colors,
|
|
||||||
},
|
},
|
||||||
{% if bom_pie_max %}
|
{% if 'price_diff' in price_history.0 %}
|
||||||
{
|
{
|
||||||
label: 'Max Price',
|
label: '{% blocktrans %}Single Price Difference - {{currency}}{% endblocktrans %}',
|
||||||
data: [{% for line in bom_parts %}{{ line.max_price }},{% endfor %}],
|
backgroundColor: 'rgba(68, 157, 68, 0.2)',
|
||||||
backgroundColor: bom_colors,
|
borderColor: 'rgb(68, 157, 68)',
|
||||||
},
|
yAxisID: 'y2',
|
||||||
|
data: [
|
||||||
|
{% for line in price_history %}{{ line.price_diff|stringformat:".2f" }},{% endfor %}
|
||||||
|
],
|
||||||
|
borderWidth: 1,
|
||||||
|
type: 'line',
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '{% blocktrans %}Part Single Price - {{currency}}{% endblocktrans %}',
|
||||||
|
backgroundColor: 'rgba(70, 127, 155, 0.2)',
|
||||||
|
borderColor: 'rgb(70, 127, 155)',
|
||||||
|
yAxisID: 'y',
|
||||||
|
data: [
|
||||||
|
{% for line in price_history %}{{ line.price_part|stringformat:".2f" }},{% endfor %}
|
||||||
|
],
|
||||||
|
borderWidth: 1,
|
||||||
|
type: 'line',
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
{% endif %}
|
{% endif %}
|
||||||
]
|
{
|
||||||
};
|
label: '{% trans "Quantity" %}',
|
||||||
var BomChart = loadBomChart(document.getElementById('BomChart'), bomdata)
|
backgroundColor: 'rgba(255, 206, 86, 0.2)',
|
||||||
|
borderColor: 'rgb(255, 206, 86)',
|
||||||
|
yAxisID: 'y1',
|
||||||
|
data: [
|
||||||
|
{% for line in price_history %}{{ line.qty|stringformat:"f" }},{% endfor %}
|
||||||
|
],
|
||||||
|
borderWidth: 1
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
var StockPriceChart = loadStockPricingChart($('#StockPriceChart'), purchasepricedata)
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if bom_parts %}
|
||||||
|
var bom_colors = randomColor({hue: 'green', count: {{ bom_parts|length }} })
|
||||||
|
var bomdata = {
|
||||||
|
labels: [{% for line in bom_parts %}'{{ line.name }}',{% endfor %}],
|
||||||
|
datasets: [
|
||||||
|
{
|
||||||
|
label: 'Price',
|
||||||
|
data: [{% for line in bom_parts %}{{ line.min_price }},{% endfor %}],
|
||||||
|
backgroundColor: bom_colors,
|
||||||
|
},
|
||||||
|
{% if bom_pie_max %}
|
||||||
|
{
|
||||||
|
label: 'Max Price',
|
||||||
|
data: [{% for line in bom_parts %}{{ line.max_price }},{% endfor %}],
|
||||||
|
backgroundColor: bom_colors,
|
||||||
|
},
|
||||||
|
{% endif %}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
var BomChart = loadBomChart(document.getElementById('BomChart'), bomdata)
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user