Pages

marți, 23 decembrie 2025

Google Apps Script : ... demonstration of the chart feature.

One simple example, see this part of source code:
 // ✅ Chart cu legendă nativă și labelInLegend pentru fiecare serie
 // ✅ Chart with native legend and labelInLegend for each series
  const chart = chartSheet.newChart()
    .setChartType(Charts.ChartType.COMBO)
    .addRange(range)
    .setPosition(1, 1, 0, 0)
    .setOption("title", "BT Funds Evolution Over Time")
    .setOption("legend", { position: "right" })
    .setOption("width", 1600)
    .setOption("height", 900)
    .setOption("seriesType", "line")
    .setOption("hAxis", { title: "Date" })
    .setOption("vAxis", { title: "Value / Return (%)" })

    // ✅ LEGENDĂ NATIVĂ CU LABEL IN LEGEND
    // ✅ NATIVE LEGEND WITH LABEL IN LEGEND
    .setOption("series", {
      0: { labelInLegend: "VUAN",      color: "#1f77b4", pointSize: 5 },
      1: { labelInLegend: "30 zile",   color: "#ff7f0e", pointSize: 5 },
      2: { labelInLegend: "YTD",       color: "#2ca02c", pointSize: 5 },
      3: { labelInLegend: "365 zile",  color: "#d62728", pointSize: 5 },
      4: { labelInLegend: "3 ani",     color: "#9467bd", pointSize: 5 }
    })
See the result