mirror of
https://github.com/frappe/books.git
synced 2024-11-13 00:46:28 +00:00
fix: y limit bug, console logs
This commit is contained in:
parent
2544687ab3
commit
55fc6d8b66
@ -31,6 +31,10 @@ export function euclideanDistance(
|
|||||||
|
|
||||||
export function getYMax(points: Array<Array<number>>): number {
|
export function getYMax(points: Array<Array<number>>): number {
|
||||||
const maxVal = Math.max(...points.flat());
|
const maxVal = Math.max(...points.flat());
|
||||||
|
if (maxVal === 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const sign = maxVal >= 0 ? 1 : -1;
|
const sign = maxVal >= 0 ? 1 : -1;
|
||||||
const texp = 10 ** Math.floor(Math.log10(Math.abs(maxVal)));
|
const texp = 10 ** Math.floor(Math.log10(Math.abs(maxVal)));
|
||||||
if (sign === 1) {
|
if (sign === 1) {
|
||||||
@ -41,6 +45,10 @@ export function getYMax(points: Array<Array<number>>): number {
|
|||||||
|
|
||||||
export function getYMin(points: Array<Array<number>>): number {
|
export function getYMin(points: Array<Array<number>>): number {
|
||||||
const minVal = Math.min(...points.flat());
|
const minVal = Math.min(...points.flat());
|
||||||
|
if (minVal === 0) {
|
||||||
|
return minVal;
|
||||||
|
}
|
||||||
|
|
||||||
const sign = minVal >= 0 ? 1 : -1;
|
const sign = minVal >= 0 ? 1 : -1;
|
||||||
const texp = 10 ** Math.floor(Math.log10(Math.abs(minVal)));
|
const texp = 10 ** Math.floor(Math.log10(Math.abs(minVal)));
|
||||||
if (sign === 1) {
|
if (sign === 1) {
|
||||||
|
@ -43,7 +43,7 @@ export default {
|
|||||||
|
|
||||||
this.$refs.tooltip.setAttribute('data-show', '');
|
this.$refs.tooltip.setAttribute('data-show', '');
|
||||||
this.virtualElement = {
|
this.virtualElement = {
|
||||||
getBoundingClientRect: generateGetBoundingClientRect(),
|
getBoundingClientRect: generateGetBoundingClientRect(-1000,-1000),
|
||||||
};
|
};
|
||||||
this.popper = createPopper(this.virtualElement, this.$refs.tooltip, {
|
this.popper = createPopper(this.virtualElement, this.$refs.tooltip, {
|
||||||
placement: this.placement,
|
placement: this.placement,
|
||||||
|
@ -57,9 +57,6 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
chartData() {
|
chartData() {
|
||||||
const points = [this.periodList.map((p) => this.data[p])];
|
const points = [this.periodList.map((p) => this.data[p])];
|
||||||
console.log(this.period);
|
|
||||||
console.log(this.data, this.periodList);
|
|
||||||
console.log(points);
|
|
||||||
const colors = [{ positive: '#2490EF', negative: '#B7BFC6' }];
|
const colors = [{ positive: '#2490EF', negative: '#B7BFC6' }];
|
||||||
const format = (value) => frappe.format(value ?? 0, 'Currency');
|
const format = (value) => frappe.format(value ?? 0, 'Currency');
|
||||||
const yMax = getYMax(points);
|
const yMax = getYMax(points);
|
||||||
|
Loading…
Reference in New Issue
Block a user