*! googlechart_writehtml v0.1.1 2026-06-28 *! Assemble the self-contained HTML for a googlechart chart. *! *! Page structure mirrors sparkta2's chart writehtml (Texas 2036 brand *! tokens, sidebar controls panel, optional under-chart export footer, *! collapsible data-table panel) -- but the renderer is Google Charts *! and the loader.js comes from gstatic.com (CDN-only by Google ToS). *! *! NOT OFFLINE. An open .html file requires network access at view time *! so the Google Charts loader and per-package code can fetch. For *! offline-capable maps and charts, use sparkta2 instead. program define googlechart_writehtml version 17.0 syntax , ENGPATH(string) ROWJSON(string) METAJSON(string) FILTERJSON(string) /// EXPORT(string) /// TYPE(string) SCHEME(string) TITLE(string) /// WIDTH(integer) HEIGHT(integer) /// ISDOWNload(integer) ISDATAtable(integer) ISANImate(integer) /// ISTX2036Style(integer) ISSTACKed(integer) ISNORMAlize(integer) /// ISDIRECTlabels(integer) /// [ SUBtitle(string) NOTE(string) /// XLAbel(string) YLAbel(string) /// XVAR(string) YVAR(string) NAME(string) OVER(string) /// LEVel(string) LEVELORDer(string) CENTERlevel(string) /// TIME(string) /// DOWNLOADPos(string) /// INNERradius(real 0) /// BUCKETSize(real 0) /// GEOREGion(string) GEORESolution(string) /// COMBOTypes(string) COMBODefault(string) /// NAMELabel(string) VALUELabel(string) /// LABELWRap(string) /// LEGENDPos(string) /// ISTBLSEArch(integer 0) /// ISTBLSTIcky(integer 0) /// TBLFROZencols(integer 0) ] if "`downloadpos'" == "" local downloadpos "side" if "`labelwrap'" == "" local labelwrap "auto" tempname fh quietly file open `fh' using `"`export'"', write text replace local esc_title : subinstr local title `"&"' `"&"', all local esc_title : subinstr local esc_title `"<"' `"<"', all local esc_title : subinstr local esc_title `">"' `">"', all file write `fh' `""' _n file write `fh' `"
"' _n file write `fh' `""' _n file write `fh' `""' _n file write `fh' `"`esc_sub'
"' _n } file write `fh' `"`esc_note'
"' _n } file write `fh' `"