Converter: #TSV String to #Butterfly-SVG File

Overview

Converter: #TSV String to #Butterfly-SVG File

コンバータ: #TSV 文字列 to #Butterfly-SVG ファイル

Converts a numeric TSV string into a stacked butterfly chart SVG file. The middle text column is detected as the aggregation unit (e.g. “2026-11” or “FY2026”), with left columns rendered extending leftward and right columns extending rightward.

Auto Step icon
Configs for this Auto Step
StrConfA
A: Set TSV String *#{EL}
StrConfB1
B1: Set Pixel Widths (Unit, Bar, Total) as CSV (def: 60,200,60)#{EL}
StrConfB2L
B2L: Set Left Series Colors (from center) (#c23,#e54,#f85,#fa9)#{EL}
StrConfB2R
B2R: Set Right Series Colors (from center) (#17c,#29e,#8ce,#bdf)#{EL}
StrConfB3
B3: Set Max Scale Value (default: 100)#{EL}
StrConfB4
B4: Set Scale Labels (from center 0 to max) (def “0,50,100%”)#{EL}
StrConfB5
B5: Set Value Prefix/Suffix in CSV (eg. “$,”, “,usd”)#{EL}
BoolConfB6
B6: Legend (Color Marker + Series Name), Hide or Show
BoolConfB7
B7: Scale Labels, Hide or Show
SelectConfC
C: Select FILE DATA to store Generated SVG (append) *
StrConfB8
B8: Set SVG File Name (default: butterfly-chart.svg)#{EL}
SelectConfD1
D1: Select NUMERIC for Number of TSV Lines (update)
SelectConfD2
D2: Select NUMERIC for TSV Rows (ignore blanks) (update)
Script (click to open)
// Script Example of Business Process Automation
// for 'engine type: 3' ("GraalJS standard mode")


//////// START "main()" /////////////////////////////////////////////////////////////////
main();
function main(){ 

//// == Config Retrieving / 工程コンフィグの参照 ==
const strTsv        = configs.get       ( "StrConfA" );     // REQUIRED
  const arr2dTsv    = parseAsRectangular( strTsv );
  if( arr2dTsv.length === 0 ){
    throw new Error( "\n AutomatedTask ConfigError:" +
                     " Config {A: TSV} is empty \n" );
  }
  if( arr2dTsv.length === 1 ){
    throw new Error( "\n AutomatedTask ConfigError:" +
                     " Config {A: TSV} requires at least 2 lines (header and data) \n" );
  }

// 表示幅: [ユニット名, 片側棒グラフ, 片側合計値]
const strWidths     = configs.get       ( "StrConfB1" ) || "60,200,60"; // default
const arrWidths     = strWidths.split(",");
const numWidthUnit  = parseInt (arrWidths[0], 10) || 60;
const numWidthBar   = parseInt (arrWidths[1], 10) || 200;
const numWidthTotal = parseInt (arrWidths[2], 10) || 60;

// 色パレット: 同系グラデーション(中央から外側へ)
const strColorsL    = configs.get       ( "StrConfB2L" ) || "#c23,#e54,#f85,#fa9"; // default 赤橙グラデーション
const arrColorsL    = strColorsL.split(",").map(s => s.trim());
const strColorsR    = configs.get       ( "StrConfB2R" ) || "#17c,#29e,#8ce,#bdf"; // default 青系グラデーション
const arrColorsR    = strColorsR.split(",").map(s => s.trim());

const parsedScale   = parseFloat( configs.get( "StrConfB3" ) );
const numMaxScale   = (parsedScale > 0) ? parsedScale : 100;

// 片側目盛りラベル (中央0から最大値へ)
const strLabels     = configs.get       ( "StrConfB4" ) || "0,50,100%";
const arrLabels     = strLabels.split(",");
const leftLabels    = arrLabels.slice().reverse(); // 左側用 (最大値 -> 0)
const rightLabels   = arrLabels;                  // 右側用 (0 -> 最大値)

const strPrefSuf    = configs.get       ( "StrConfB5" ) || ","; // デフォルトはカンマのみ
const arrPrefSuf    = strPrefSuf.split(",");
const strPrefix     = arrPrefSuf[0] || "";
const strSuffix     = arrPrefSuf.length > 1 ? arrPrefSuf[1] : "";
const isShowLegend  = configs.getObject ( "BoolConfB6" );
const isShowLabels  = configs.getObject ( "BoolConfB7" );
const strFileName   = configs.get       ( "StrConfB8" ) || "butterfly-chart.svg";
const filesPocketC  = configs.getObject ( "SelectConfC" ); // REQUIRED
const numPocketD1   = configs.getObject ( "SelectConfD1" );
const numPocketD2   = configs.getObject ( "SelectConfD2" );


//// == Data Parsing & Label Column Detection ==
// データ行(2行目以降)を走査して、集計単位となる「中央ラベル列(非数値列)」を特定
const numCols = arr2dTsv[0].length;
let labelColIndex = -1;

for (let c = 0; c < numCols; c++) {
  let isNumericCol = true;
  for (let r = 1; r < arr2dTsv.length; r++) {
    const rawVal = arr2dTsv[r][c].trim();
    if (rawVal === "") continue;
    // カンマ、空白、通貨記号(¥, ¥, $, €)のみを除去して純粋な数値か判定
    const numCandidate = rawVal.replace(/[,\s¥¥$€%]/g, "");
    if (numCandidate === "" || isNaN(Number(numCandidate))) {
      isNumericCol = false;
      break;
    }
  }
  if (!isNumericCol) {
    labelColIndex = c;
    break; // 非数値(ラベル)が含まれる列を中心ラベル列と特定
  }
}

// 全列が純粋な数値(例: 202601 等のYYYYMM形式)で見つからない場合のフォールバック(中央列)
if (labelColIndex === -1) {
  labelColIndex = Math.floor(numCols / 2);
  engine.log(" AutomatedTask Warning: Label column not detected by text format. Defaulted to column index " + labelColIndex + ".");
}


//// == Calculating / 演算 (SVG文字列の生成) ==
const marginL = 15; // 左側の余白
const marginR = 15; // 右側の余白
const xTotalL = marginL;
const xBarL   = xTotalL + numWidthTotal;
const xUnit   = xBarL   + numWidthBar;
const xBarR   = xUnit   + numWidthUnit;
const xTotalR = xBarR   + numWidthBar;
const svgTotalWidth = xTotalR + numWidthTotal + marginR;

let svgY = 12; // Y座標の初期オフセット
let svgContent = `<style>text { font-family: sans-serif; font-size: 12px; fill: #333; }</style>\n`;

// XMLエスケープ用関数
function escapeXml(unsafe) {
  if (unsafe === null || unsafe === undefined) return "";
  return String(unsafe).replace(/[<>&'"]/g, function (c) {
    switch (c) {
      case '<': return '<';
      case '>': return '>';
      case '&': return '&';
      case '\'': return ''';
      case '"': return '"';
    }
  });
}

// --- 1. 凡例の描画 ---
// TSVの物理的並び順(左端列0から右端列numCols-1まで自然に流す)に統一
if (isShowLegend) {
  let lx = marginL;
  const legendItems = [];

  // 左系列: 列0から labelColIndex - 1 へ(画面の左端から中央へ向かう順)
  for (let i = 0; i < labelColIndex; i++) {
    const distFromCenter = (labelColIndex - 1) - i;
    const color = arrColorsL[distFromCenter % arrColorsL.length];
    legendItems.push({ type: "series", name: arr2dTsv[0][i], color: color });
  }
  // 中央ラベル列のヘッダー名
  legendItems.push({ type: "unit", name: "[" + arr2dTsv[0][labelColIndex] + "]" });
  // 右系列: labelColIndex + 1 から numCols - 1 へ(中央から右端へ向かう順)
  for (let i = labelColIndex + 1; i < numCols; i++) {
    const distFromCenter = i - (labelColIndex + 1);
    const color = arrColorsR[distFromCenter % arrColorsR.length];
    legendItems.push({ type: "series", name: arr2dTsv[0][i], color: color });
  }

  for (let idx = 0; idx < legendItems.length; idx++) {
    const item = legendItems[idx];
    const safeName = escapeXml(item.name);
    // 文字幅の簡易推定(マルチバイト文字は幅広めに計算)
    let charWidthSum = 0;
    for (let c = 0; c < item.name.length; c++) {
      charWidthSum += (item.name.charCodeAt(c) > 255) ? 12 : 7;
    }
    const estimateW = charWidthSum + (item.type === "series" ? 18 : 8);

    if (lx + estimateW > svgTotalWidth - marginR && lx > marginL) {
      lx = marginL;
      svgY += 18;
    }

    if (item.type === "series") {
      svgContent += `<rect x="${lx}" y="${svgY}" width="10" height="10" fill="${escapeXml(item.color)}" rx="2"/>\n`;
      svgContent += `<text x="${lx + 14}" y="${svgY + 9}" fill="${escapeXml(item.color)}">${safeName}</text>\n`;
    } else {
      svgContent += `<text x="${lx}" y="${svgY + 9}" fill="#555" font-weight="bold">${safeName}</text>\n`;
    }
    lx += estimateW + 10;
  }
  svgY += 24; // 下部マージン
}

// --- 2. 目盛りの描画 ---
if (isShowLabels) {
  // 左目盛り (外側 -> 中央0)
  const stepWL = numWidthBar / (leftLabels.length - 1 || 1);
  for (let i = 0; i < leftLabels.length; i++) {
    const xPos = parseFloat((xBarL + (stepWL * i)).toFixed(2));
    const anchor = i === 0 ? "start" : i === leftLabels.length - 1 ? "end" : "middle";
    svgContent += `<text x="${xPos}" y="${svgY + 10}" fill="#777" font-size="11" text-anchor="${anchor}">${escapeXml(leftLabels[i])}</text>\n`;
  }

  // 右目盛り (中央0 -> 外側)
  const stepWR = numWidthBar / (rightLabels.length - 1 || 1);
  for (let i = 0; i < rightLabels.length; i++) {
    const xPos = parseFloat((xBarR + (stepWR * i)).toFixed(2));
    const anchor = i === 0 ? "start" : i === rightLabels.length - 1 ? "end" : "middle";
    svgContent += `<text x="${xPos}" y="${svgY + 10}" fill="#777" font-size="11" text-anchor="${anchor}">${escapeXml(rightLabels[i])}</text>\n`;
  }

  svgY += 18;
}

// --- 3. 棒グラフの描画 ---
const rowHeight = 18; // 1行の高さ
for (let i = 1; i < arr2dTsv.length; i++) {
  // 左系列の計算(中央から外側へ: labelColIndex - 1 から 0 へ)
  let totalValL = 0;
  const barsL = [];
  for (let j = labelColIndex - 1; j >= 0; j--) {
    const rawVal = arr2dTsv[i][j] ? arr2dTsv[i][j].replace(/[^0-9.-]/g, "") : "";
    const cellValue = parseFloat(rawVal) || 0;
    totalValL += cellValue;
    const distFromCenter = (labelColIndex - 1) - j;
    const color = arrColorsL[distFromCenter % arrColorsL.length];
    barsL.push({ name: arr2dTsv[0][j], val: cellValue, color: color });
  }

  // 右系列の計算(中央から外側へ: labelColIndex + 1 から numCols - 1 へ)
  let totalValR = 0;
  const barsR = [];
  for (let j = labelColIndex + 1; j < numCols; j++) {
    const rawVal = arr2dTsv[i][j] ? arr2dTsv[i][j].replace(/[^0-9.-]/g, "") : "";
    const cellValue = parseFloat(rawVal) || 0;
    totalValR += cellValue;
    const distFromCenter = j - (labelColIndex + 1);
    const color = arrColorsR[distFromCenter % arrColorsR.length];
    barsR.push({ name: arr2dTsv[0][j], val: cellValue, color: color });
  }

  // ① 左合計値(左棒グラフのすぐ左に右揃え配置)
  const totalStrL = `${strPrefix}${totalValL.toLocaleString()}${strSuffix}`;
  svgContent += `<text x="${xBarL - 6}" y="${svgY + 13}" text-anchor="end">${escapeXml(totalStrL)}</text>\n`;

  // ② 左側棒グラフ(背景グレー + 中央xUnitから左方向へ積み上げ)
  svgContent += `<rect x="${xBarL}" y="${svgY + 4}" width="${numWidthBar}" height="10" fill="#eee" rx="2"/>\n`;
  const scaleFactorL = totalValL > numMaxScale ? (numWidthBar / totalValL) : (numWidthBar / numMaxScale);
  let currentXL = xUnit; // 中央軸側(右端)からスタートして左へ進む
  for (let b = 0; b < barsL.length; b++) {
    if (barsL[b].val > 0) {
      const barW = parseFloat((barsL[b].val * scaleFactorL).toFixed(2));
      if (barW > 0) {
        currentXL = parseFloat((currentXL - barW).toFixed(2));
        const valStr = `${strPrefix}${barsL[b].val.toLocaleString()}${strSuffix}`;
        const tooltipText = escapeXml(`${barsL[b].name}: ${valStr}`);
        svgContent += `<rect x="${currentXL}" y="${svgY + 4}" width="${barW}" height="10" fill="${escapeXml(barsL[b].color)}">\n`;
        svgContent += `  <title>${tooltipText}</title>\n`;
        svgContent += `</rect>\n`;
      }
    }
  }

  // ③ 中央ユニット名(中央揃え)
  const centerXUnit = parseFloat((xUnit + (numWidthUnit / 2)).toFixed(2));
  svgContent += `<text x="${centerXUnit}" y="${svgY + 13}" text-anchor="middle">${escapeXml(arr2dTsv[i][labelColIndex])}</text>\n`;

  // ④ 右側棒グラフ(背景グレー + 中央xBarRから右方向へ積み上げ)
  svgContent += `<rect x="${xBarR}" y="${svgY + 4}" width="${numWidthBar}" height="10" fill="#eee" rx="2"/>\n`;
  const scaleFactorR = totalValR > numMaxScale ? (numWidthBar / totalValR) : (numWidthBar / numMaxScale);
  let currentXR = xBarR; // 中央軸側(左端)からスタートして右へ進む
  for (let b = 0; b < barsR.length; b++) {
    if (barsR[b].val > 0) {
      const barW = parseFloat((barsR[b].val * scaleFactorR).toFixed(2));
      if (barW > 0) {
        const valStr = `${strPrefix}${barsR[b].val.toLocaleString()}${strSuffix}`;
        const tooltipText = escapeXml(`${barsR[b].name}: ${valStr}`);
        svgContent += `<rect x="${currentXR}" y="${svgY + 4}" width="${barW}" height="10" fill="${escapeXml(barsR[b].color)}">\n`;
        svgContent += `  <title>${tooltipText}</title>\n`;
        svgContent += `</rect>\n`;
        currentXR = parseFloat((currentXR + barW).toFixed(2));
      }
    }
  }

  // ⑤ 右合計値(右棒グラフのすぐ右に左揃え配置)
  const totalStrR = `${strPrefix}${totalValR.toLocaleString()}${strSuffix}`;
  svgContent += `<text x="${xTotalR + 6}" y="${svgY + 13}" text-anchor="start">${escapeXml(totalStrR)}</text>\n`;

  svgY += rowHeight; // 次の行へY座標を移動
}

// --- 4. 全体をSVGタグでラップ ---
const finalSvgHeight = svgY + 10;
let strSvg = `<?xml version="1.0" encoding="UTF-8"?>\n`;
strSvg += `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${svgTotalWidth} ${finalSvgHeight}" width="${svgTotalWidth}" height="${finalSvgHeight}">\n`;
strSvg += `<rect width="100%" height="100%" fill="#ffffff"/>\n`; // 背景の透過防止用白塗り
strSvg += svgContent;
strSvg += `</svg>`;


//// == Data Updating / ワークフローデータへの代入 ==

// SVGファイルの保存 (C)
if (filesPocketC !== null) { 
  let filesSvg = engine.findData(filesPocketC);
  if (filesSvg === null) {
    filesSvg = new java.util.ArrayList();
  }
  
  let finalFileName = strFileName;
  if (!finalFileName.toLowerCase().endsWith(".svg")) {
    finalFileName += ".svg";
  }

  filesSvg.add(
    new com.questetra.bpms.core.event.scripttask.NewQfile(
      finalFileName,
      "image/svg+xml; charset=UTF-8",
      strSvg
    )
  );
  engine.setData(filesPocketC, filesSvg);
}

// オリジナルのTSV文字列の行数 (D1)
if ( numPocketD1 !== null) { 
  const totalLines = strTsv.replace(/\r\n?/g, "\n").split("\n").length;
  engine.setData( numPocketD1, new java.math.BigDecimal(totalLines) );
}

// 空行を除いたTSV行数 (D2)
if ( numPocketD2 !== null) { 
  engine.setData( numPocketD2, new java.math.BigDecimal(arr2dTsv.length) );
}

} //////// END "main()" /////////////////////////////////////////////////////////////////


/**
 * Parses TSV string as a two-dimensional rectangular data matrix and creates a 2D array.
 * @param {string} strTsv - The input TSV string
 * @returns {Array<Array<string>>} Rectangular 2D array
 */
function parseAsRectangular( strTsv ){
  const arrTsv = strTsv.replace(/\r\n?/g, "\n").split("\n");
  let numMinWidth   = Infinity;
  let numMaxWidth   = 0;
  let numBlanklines = 0;
  
  const parsedRows = [];
  for( let i = 0; i < arrTsv.length; i++ ){
    const line = arrTsv[i];
    if( line === "" ){
      numBlanklines++;
      continue;
    }
    const arrCells = line.split("\t");
    const len = arrCells.length;
    if( len < numMinWidth ){ numMinWidth = len; }
    if( len > numMaxWidth ){ numMaxWidth = len; }
    parsedRows.push( arrCells );
  }
  if( numMinWidth === Infinity ){
    numMinWidth = 0;
  }
  engine.log( " AutomatedTask TsvDataCheck:" + 
              " MinWidth:" + numMinWidth +
              " MaxWidth:" + numMaxWidth +
              " Lines:" + arrTsv.length +
              " (BlankLines:" + numBlanklines + ")" );

  for( let i = 0; i < parsedRows.length; i++ ){
    const row = parsedRows[i];
    while( row.length < numMaxWidth ){
      row.push( "" );
    }
  }
  return parsedRows;
}


/*
### NOTES-en
- A stacked butterfly chart (SVG file) is automatically generated each time a Case reaches this Automated Step.
    - The TSV format expects the unit label (such as "Quarter" or "YYYY-MM") to be in the middle column, flanked by left data series and right data series.
    - Data rows from the second line onward are inspected to automatically detect the aggregation unit column (the column containing non-numeric strings).
        - Characters like currency symbols ($ / ¥ / €) and thousands separator commas (,) are stripped before evaluating numeric values.
        - If all columns are numeric (e.g. pure numbers like "202601"), the center column is chosen as a fail-safe fallback.
    - The generated "SVG file" will be appended to the specified File-type data item.
        - Left series are accumulated and rendered from the center baseline outwards to the left.
        - Right series are accumulated and rendered from the center baseline outwards to the right.
        - Each segment includes a `<title>` tooltip showing the series name and formatted value on hover.
        - If the stacked total value on either side exceeds the "Max Scale Value (B3)", the bars on that side are automatically scaled down to fit within `numWidthBar`.
- The input TSV is parsed as the "simplest tab-separated string".
- The number of lines in the input TSV string can also be saved as Case Data.

### NOTES-ja
- このアドオン自動工程にケース(案件)が到達する度に、自動的に左右対称の積み上げバタフライチャート(SVGファイル)が生成されます。
    - 入力TSVは、中央の集計単位ラベル(「四半期」や「年月」など)を挟んで、左側に左系列データ、右側に右系列データが配置された形式を想定しています。
    - 2行目以降のデータ行を解析し、非数値文字列が含まれる列(中央列)が集計単位ラベルとして自動判定されます。
        - 通貨記号(¥, $, €)や桁区切りカンマ(,)は除去された上で数値判定が行われるため、"FY2026" や "2026-Q1" といった英字・記号付きラベルも正確に判定されます。
        - 全列が純粋な数値文字列("202601" など)の場合は、フェイルセーフとして中央付近の列が集計単位ラベルとして採用されます。
    - 生成された "SVGファイル" は、指定されたファイル型データ項目に追加保存されます。
        - 中央ラベル列の左側にある各系列は、中央軸から外側(左方向)へ積み上げ描画されます。
        - 中央ラベル列の右側にある各系列は、中央軸から外側(右方向)へ積み上げ描画されます。
        - 各グラフ要素には `<title>` タグが埋め込まれ、マウスホバー時に「系列名: 数値」のツールチップが表示されます。
        - いずれかの側の積み上げ合計値が「グラフ目盛りの最大値(B3)」を超えた場合、片側表示幅(`numWidthBar`)に収まるよう自動縮小されます。
- 入力TSVは「もっともシンプルなタブ区切り文字列」としてパースされます。
- 入力TSV文字列の行数もケースデータとして格納可能です。

#### TSV example
SG&A	R&D	Labor	Material	Quarter	Domestic	NorthAmerica	Europe	APAC
10	12	18	22	2025-Q1	28	20	14	10
11	13	19	23	2025-Q2	30	22	15	11
12	14	20	24	2025-Q3	31	23	16	12
13	15	21	26	2025-Q4	34	26	18	14
11	14	19	24	2026-Q1	31	23	16	12
12	15	20	25	2026-Q2	33	25	17	13
13	16	21	26	2026-Q3	35	26	18	14

### APPENDIX-en
- Blank lines within the input TSV string are ignored.
- Pixel Widths (B1): Set CSV values as "Unit Width, Bar Width (one side), Total Width (one side)". The entire chart width will be LeftMargin + Total + Bar + Unit + Bar + Total + RightMargin.
- Scale Labels (B4): Specify scale values from center (0) to outer edge (max). Left-side labels are automatically reversed.
- The order of colors specified in CSV applies from the center baseline outwards to the sides:
    - Left Series Colors (B2L): The 1st color is assigned to the column immediately to the left of the center label, the 2nd color to the next column outward, and so on.
    - Right Series Colors (B2R): The 1st color is assigned to the column immediately to the right of the center label, the 2nd color to the next column outward, and so on.
- The legend order matches the visual left-to-right order of the TSV table and stacked bars.
- Special characters like `<`, `>`, `&` in the TSV string are automatically XML-escaped to prevent SVG corruption.
- You can specify a prefix and suffix for total values on both ends:
    - To add only a prefix: Set `$,` → `$62`
    - To add only a suffix: Set `,M` → `62M`
    - To add both: Set `approx. , units` → `approx. 62 units`

### APPENDIX-ja
- 入力TSV文字列内の空行は無視されます。
- 表示幅(B1):「ユニット名幅, 棒グラフ幅(片側), 合計値幅(片側)」をCSVで指定します。SVG全体の横幅は「左余白 + 合計値 + 棒グラフ + ユニット名 + 棒グラフ + 合計値 + 右余白」となります。
- 目盛り文字列(B4):「中央(0)から最大値に向かう順」で指定します。左側目盛りには自動的に反転した順序で配置されます。
- 系列色のCSV設定は、左右ともに「中央軸から外側に向かう順」で適用されます。
    - 左系列(B2L):1番目の色が中央ラベルの直左の列に、2番目の色がさらにその外側の列に適用されます。
    - 右系列(B2R):1番目の色が中央ラベルの直右の列に、2番目の色がさらにその外側の列に適用されます。
- 凡例は、チャートおよびTSVの並びと同じく「左端から中央を経て右端へ流れる自然な順序」で出力されます。
- TSV内の `<` や `&` といった特殊記号は、SVGファイルの破損を防ぐために自動的にXMLエスケープされます。
- 左右の合計値およびツールチップには共通の接頭辞・接尾辞を指定できます。
    - 前だけにつけたい場合: `¥,` と設定 → `¥62`
    - 後ろだけにつけたい場合: `,百万円` と設定 → `62百万円`
    - 前後両方につけたい場合: `約,件` と設定 → `約62件`
*/

Download

warning Freely modifiable JavaScript (ECMAScript) code. No warranty of any kind.
(Installing Addon Auto-Steps are available only on the Professional edition.)

Notes

  • A stacked butterfly chart (SVG file) is automatically generated each time a Case reaches this Automated Step.
    • The TSV format expects the unit label (such as “Quarter” or “YYYY-MM”) to be in the middle column, flanked by left data series and right data series.
    • Data rows from the second line onward are inspected to automatically detect the aggregation unit column (the column containing non-numeric strings).
      • Characters like currency symbols ($ / \ / ?) and thousands separator commas (,) are stripped before evaluating numeric values.
      • If all columns are numeric (e.g. pure numbers like “202601”), the center column is chosen as a fail-safe fallback.
    • The generated “SVG file” will be appended to the specified File-type data item.
      • Left series are accumulated and rendered from the center baseline outwards to the left.
      • Right series are accumulated and rendered from the center baseline outwards to the right.
      • Each segment includes a <title> tooltip showing the series name and formatted value on hover.
      • If the stacked total value on either side exceeds the “Max Scale Value (B3)”, the bars on that side are automatically scaled down to fit within numWidthBar.
  • The input TSV is parsed as the “simplest tab-separated string”.
  • The number of lines in the input TSV string can also be saved as Case Data.

Capture

Appendix

  • Blank lines within the input TSV string are ignored.
  • Pixel Widths (B1): Set CSV values as “Unit Width, Bar Width (one side), Total Width (one side)”. The entire chart width will be LeftMargin + Total + Bar + Unit + Bar + Total + RightMargin.
  • Scale Labels (B4): Specify scale values from center (0) to outer edge (max). Left-side labels are automatically reversed.
  • The order of colors specified in CSV applies from the center baseline outwards to the sides:
    • Left Series Colors (B2L): The 1st color is assigned to the column immediately to the left of the center label, the 2nd color to the next column outward, and so on.
    • Right Series Colors (B2R): The 1st color is assigned to the column immediately to the right of the center label, the 2nd color to the next column outward, and so on.
  • The legend order matches the visual left-to-right order of the TSV table and stacked bars.
  • Special characters like <, >, & in the TSV string are automatically XML-escaped to prevent SVG corruption.
  • You can specify a prefix and suffix for total values on both ends:
    • To add only a prefix: Set $, → $62
    • To add only a suffix: Set ,M → 62M
    • To add both: Set approx. , units → approx. 62 units

See Also