Browse Source

[fix] zero bar height positive

tags/1.2.0
Prateeksha Singh 7 years ago
parent
commit
436685872e
10 changed files with 20 additions and 24 deletions
  1. +6
    -7
      dist/frappe-charts.esm.js
  2. +1
    -1
      dist/frappe-charts.min.cjs.js
  3. +1
    -1
      dist/frappe-charts.min.esm.js
  4. +1
    -1
      dist/frappe-charts.min.iife.js
  5. +1
    -1
      dist/frappe-charts.min.iife.js.map
  6. +1
    -1
      docs/assets/js/frappe-charts.min.js
  7. +1
    -1
      docs/assets/js/frappe-charts.min.js.map
  8. +1
    -8
      docs/assets/js/index.min.js
  9. +1
    -1
      docs/assets/js/index.min.js.map
  10. +6
    -2
      src/js/utils/draw.js

+ 6
- 7
dist/frappe-charts.esm.js View File

@@ -297,10 +297,6 @@ class SvgTip {
}
}

/**
* Returns the value of a number upto 2 decimal places.
* @param {Number} d Any number
*/
function floatTwo(d) {
return parseFloat(d.toFixed(2));
}
@@ -871,6 +867,11 @@ function datasetBar(x, yTop, width, color, label='', index=0, offset=0, meta={})
let [height, y] = getBarHeightAndYAttr(yTop, meta.zeroLine);
y -= offset;

if(height === 0) {
height = meta.minHeight;
y -= meta.minHeight;
}

let rect = createSVG('rect', {
className: `bar mini`,
style: `fill: ${color}`,
@@ -878,7 +879,7 @@ function datasetBar(x, yTop, width, color, label='', index=0, offset=0, meta={})
x: x,
y: y,
width: width,
height: height || meta.minHeight // TODO: correct y for positive min height
height: height
});

label += "";
@@ -966,7 +967,6 @@ function getPaths(xList, yList, color, options={}, meta={}) {
if(options.regionFill) {
let gradient_id_region = makeGradient(meta.svgDefs, color, true);

// TODO: use zeroLine OR minimum
let pathStr = "M" + `${xList[0]},${meta.zeroLine}L` + pointsStr + `L${xList.slice(-1)[0]},${meta.zeroLine}`;
paths.region = makePath(pathStr, `region-fill`, 'none', `url(#${gradient_id_region})`);
}
@@ -3642,7 +3642,6 @@ class AxisChart extends BaseChart {
// removeDataPoint(index = 0) {}
}

// import MultiAxisChart from './charts/MultiAxisChart';
const chartTypes = {
bar: AxisChart,
line: AxisChart,


+ 1
- 1
dist/frappe-charts.min.cjs.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/frappe-charts.min.esm.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/frappe-charts.min.iife.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/frappe-charts.min.iife.js.map
File diff suppressed because it is too large
View File


+ 1
- 1
docs/assets/js/frappe-charts.min.js
File diff suppressed because it is too large
View File


+ 1
- 1
docs/assets/js/frappe-charts.min.js.map
File diff suppressed because it is too large
View File


+ 1
- 8
docs/assets/js/index.min.js View File

@@ -46,12 +46,6 @@ var HEATMAP_COLORS_YELLOW = ['#ebedf0', '#fdf436', '#ffc700', '#ff9100', '#06001

// Universal constants

/**
* Returns the value of a number upto 2 decimal places.
* @param {Number} d Any number
*/


/**
* Returns whether or not two given arrays are equal.
* @param {Array} arr1 First array
@@ -120,6 +114,7 @@ var MONTH_NAMES_SHORT = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",



// https://stackoverflow.com/a/11252167/6495043


function clone(date) {
@@ -299,8 +294,6 @@ var heatmapData = {
end: end
};

// ================================================================================

var c1 = document.querySelector("#chart-composite-1");
var c2 = document.querySelector("#chart-composite-2");



+ 1
- 1
docs/assets/js/index.min.js.map
File diff suppressed because it is too large
View File


+ 6
- 2
src/js/utils/draw.js View File

@@ -454,6 +454,11 @@ export function datasetBar(x, yTop, width, color, label='', index=0, offset=0, m
let [height, y] = getBarHeightAndYAttr(yTop, meta.zeroLine);
y -= offset;

if(height === 0) {
height = meta.minHeight;
y -= meta.minHeight;
}

let rect = createSVG('rect', {
className: `bar mini`,
style: `fill: ${color}`,
@@ -461,7 +466,7 @@ export function datasetBar(x, yTop, width, color, label='', index=0, offset=0, m
x: x,
y: y,
width: width,
height: height || meta.minHeight // TODO: correct y for positive min height
height: height
});

label += "";
@@ -549,7 +554,6 @@ export function getPaths(xList, yList, color, options={}, meta={}) {
if(options.regionFill) {
let gradient_id_region = makeGradient(meta.svgDefs, color, true);

// TODO: use zeroLine OR minimum
let pathStr = "M" + `${xList[0]},${meta.zeroLine}L` + pointsStr + `L${xList.slice(-1)[0]},${meta.zeroLine}`;
paths.region = makePath(pathStr, `region-fill`, 'none', `url(#${gradient_id_region})`);
}


Loading…
Cancel
Save