arty-charty/util.js
function makeStackedBarsChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, paddingLeft, yAxisWidth, isRange) {
    let heightScaler = (chartHeight-markerRadius)/maxValue;
    width = width - yAxisWidth;
    let xSpacing = width / pointsOnScreen;
    let barWidth = xSpacing - paddingLeft;
    let fullWidth = paddingLeft/2 + (paddingLeft+barWidth) * (chart.data.length-1) + barWidth;
    let paths = []
    let barCords = [];
    let x1, y1, y2;
    chart.data.some((d, idx) => {
        x1 = paddingLeft/2 + (paddingLeft+barWidth) * idx + yAxisWidth;
        if (x1 > fullWidth * t && chart.drawChart) {
          return true;
        }
        if (chart.stretchChart) {
          x1 = x1 * t;
        }
        let prevY = 0;
        d.forEach((stack) => {
          y1 = (chartHeight+chartHeightOffset) - (stack.value+prevY) * heightScaler * (chart.timingFunctions ? chart.timingFunctions[idx % chart.timingFunctions.length](t) : 1);
          //y2 = isRange ? (chartHeight+chartHeightOffset) - prevY * heightScaler * (chart.timingFunctions ? chart.timingFunctions[idx % chart.timingFunctions.length](t) : 1) : (chartHeight+chartHeightOffset);
          y2 = isRange ? (chartHeight+chartHeightOffset) - prevY * heightScaler * (chart.timingFunctions ? chart.timingFunctions[idx % chart.timingFunctions.length](t) : 1) : (chartHeight+chartHeightOffset);
          prevY += stack.value;
          paths.push({path: makeBarPath(x1, y1, y2, barWidth), color: stack.color});
          barCords.push({x1: x1, x2: x1+barWidth, y1: y1, y2: y2});
          });
    });
    return {
      //path: pathStr.join(' '),
      path: paths,
      width: fullWidth,
      maxScroll: fullWidth - width,
      barCords: barCords
    };
  }
function makeStackedBarsChartPath(chart, width, t, maxValue, chartHeight, chartHeightOffset, markerRadius, pointsOnScreen, paddingLeft, yAxisWidth, isRange) {
    let heightScaler = (chartHeight-markerRadius)/maxValue;
    width = width - yAxisWidth;
    let xSpacing = width / pointsOnScreen;
    let barWidth = xSpacing - paddingLeft;
    let fullWidth = paddingLeft/2 + (paddingLeft+barWidth) * (chart.data.length-1) + barWidth;
    let paths = []
    let barCords = [];
    let x1, y1, y2;
    chart.data.some((d, idx) => {
        x1 = paddingLeft/2 + (paddingLeft+barWidth) * idx + yAxisWidth;
        if (x1 > fullWidth * t && chart.drawChart) {
          return true;
        }
        if (chart.stretchChart) {
          x1 = x1 * t;
        }
        let prevY = 0;
        d.forEach((stack) => {
          y1 = (chartHeight+chartHeightOffset) - (stack.value+prevY) * heightScaler * (chart.timingFunctions ? chart.timingFunctions[idx % chart.timingFunctions.length](t) : 1);
          //y2 = isRange ? (chartHeight+chartHeightOffset) - prevY * heightScaler * (chart.timingFunctions ? chart.timingFunctions[idx % chart.timingFunctions.length](t) : 1) : (chartHeight+chartHeightOffset);
          y2 = isRange ? (chartHeight+chartHeightOffset) - prevY * heightScaler * (chart.timingFunctions ? chart.timingFunctions[idx % chart.timingFunctions.length](t) : 1) : (chartHeight+chartHeightOffset);
          prevY += stack.value;
          paths.push({path: makeBarPath(x1, y1, y2, barWidth), color: stack.color});
          barCords.push({x1: x1, x2: x1+barWidth, y1: y1, y2: y2});
          });
    });
    return {
      //path: pathStr.join(' '),
      path: paths,
      width: fullWidth,
      maxScroll: fullWidth - width,
      barCords: barCords
    };
  }
function makeStackedBarsChartPath ( chart , width , t , maxValue , chartHeight , chartHeightOffset , markerRadius , pointsOnScreen , paddingLeft , yAxisWidth , isRange ) { let heightScaler = ( chartHeight - markerRadius ) / maxValue ; width = width - yAxisWidth ; let xSpacing = width / pointsOnScreen ; let barWidth = xSpacing - paddingLeft ; let fullWidth = paddingLeft / 2 + ( paddingLeft + barWidth ) * ( chart . data . length - 1 ) + barWidth ; let paths = [ ] let barCords = [ ] ; let x1 , y1 , y2 ; chart . data . some ( ( d , idx ) => { x1 = paddingLeft / 2 + ( paddingLeft + barWidth ) * idx + yAxisWidth ; if ( x1 > fullWidth * t && chart . drawChart ) { return true ; } if ( chart . stretchChart ) { x1 = x1 * t ; } let prevY = 0 ; d . forEach ( ( stack ) => { y1 = ( chartHeight + chartHeightOffset ) - ( stack . value + prevY ) * heightScaler * ( chart . timingFunctions ? chart . timingFunctions [ idx % chart . timingFunctions . length ] ( t ) : 1 ) ; //y2 = isRange ? (chartHeight+chartHeightOffset) - prevY * heightScaler * (chart.timingFunctions ? chart.timingFunctions[idx % chart.timingFunctions.length](t) : 1) : (chartHeight+chartHeightOffset); y2 = isRange ? ( chartHeight + chartHeightOffset ) - prevY * heightScaler * ( chart . timingFunctions ? chart . timingFunctions [ idx % chart . timingFunctions . length ] ( t ) : 1 ) : ( chartHeight + chartHeightOffset ) ; prevY += stack . value ; paths . push ( { path : makeBarPath ( x1 , y1 , y2 , barWidth ) , color : stack . color } ) ; barCords . push ( { x1 : x1 , x2 : x1 + barWidth , y1 : y1 , y2 : y2 } ) ; } ) ; } ) ; return { //path: pathStr.join(' '), path : paths , width : fullWidth , maxScroll : fullWidth - width , barCords : barCords } ; }
Make like candle-stick, where each stck is its own Shape
Make like candle - stick where each stck is its own Shape