Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Introducing sparkta - Stata's first interactive chart package

    One command. One file. No server, no Python, no R.

    ---

    📦 Free, open source, one-line install

    Code:
    net install sparkta, from("https://raw.githubusercontent.com/fahad-mirza/sparkta_stata/main/ado/") replace
    Requires Stata 17+. Uses Stata's bundled Java - nothing else to install.

    GitHub:
    https://github.com/fahad-mirza/sparkta_stata

    * Please report any bugs

    ---

    Example Code:

    Code:
    sysuse auto, clear
    sparkta price mpg, type(scatter) fit(lfit) fitci sliders(mpg)
    That one line produces a fully interactive HTML chart and opens your browser to display a live CI band that recomputes as you drag the slider. No Python environment. No R packages. No Tableau license. Just Stata doing what it already does, and now doing it interactively using Java.

    For researchers at institutions with restricted internet or air-gapped systems, there's a built-in "offline" mode. Entire chart library is bundled inside the jar, no CDN calls, no network dependency, nothing to whitelist with IT.

    ---

    📊 What Sparkta does

    You write a Stata command. Sparkta builds a fully self-contained .html file that:

    → Opens in any browser, anywhere
    → Has live filter dropdowns and dual-handle range sliders
    → Shows N, mean, SD, median, CV, sparklines all updating live
    → Works offline (air-gapped institutions, reproducibility archives)
    → Can be emailed - the interactivity travels with the file

    No installation on the recipient's end. No CDN. No dependencies.

    ---

    📈 This is the updated release and this is what is new in this version

    Here's what changed:

    FIT LINES + CI BANDS (brand new)
    7 types: lfit · qfit · lowess · exp · log · power · moving average
    Add fitci and get an asymmetric CI band. Hook it to a slider and the band recomputes live as you drag.

    FILTER ENGINE (rebuilt from scratch)
    Was: max 2 dropdown filters, pre-computed, HTML grew exponentially
    Now: unlimited filters + dual-handle sliders, row-level engine in the browser, O(N) aggregation

    REFERENCE ANNOTATIONS (19 new options)
    yline() · xline() · yband() · xband() · apoint() · aellipse() · alabelpos()
    Draw reference lines, shaded bands, point markers, text labels, ellipses — all offline-safe

    COLOR PALETTES (14 themes)
    Tableau 10 · ColorBrewer Set1 & Dark2 · Okabe-Ito (colorblind-safe) · viridis · neon
    Combine with dark/light backgrounds: theme(dark_viridis), theme(light_cblind1)

    PERFORMANCE
    500k obs × 100 groups: from 4 seconds → to 0.5 seconds
    HTML file: from 40 MB → to 2 MB with the help of lazy sparkline rendering

    ---

    âš¡ Before vs After
    Filter variables: before a max of 2, now unlimited
    Fit lines: before none, now 7 types
    CI bands: before none, now recomputes with sliders
    Annotations: before none, now multiple options
    Color themes: before 2, now 17
    Stats panel: before, static summary stats but now, it updates with filter, and sliders
    Performance: previously O(N×G), now O(N)

    ---

    🎯 Who is this for?

    Researchers who want publication-quality interactive charts inside their Stata workflow without leaving Stata, learning JavaScript, or setting up a server.

    Particularly useful for:
    • Conference presentations (self-contained file, works anywhere)
    • Supplementary materials (offline HTML = permanent reproducible snapshot)
    • Air-gapped institutional networks (offline mode, no CDN)
    • Sharing results with non-Stata colleagues

    ---

    Happy to answer questions, drop them in the comments.


    Additional Details:

    I am trying to get this package submitted to SSC but having trouble sharing files via email to KitBaum due to mail service security reasons as the ZIP contains a JAR file. Hopefully there is some alternate way possible to submit.

    Also, special thanks to wbuchanan for introducing this idea in one of his presentations back in 2016 (if i am not wrong).
    Last edited by Fahad Mirza; 20 Mar 2026, 08:26. Reason: Special thanks note for William Buchanan added

  • #2
    Fahad Mirza Plaudits for this!

    Comment


    • #3
      Thank you Stephen Jenkins but please share issues as you become aware of them because I am not able to test every single combination of the features

      Comment


      • #4
        This is awesome! Excited to try out.

        Comment


        • #5
          What is the origin of the name "sparkta"? Or is it an abbreviation for something?

          Comment


          • #6
            Originally posted by Chen Samulsion View Post
            What is the origin of the name "sparkta"? Or is it an abbreviation for something?
            Sorry for the late reply. So this is a combination of Spark + Stata. Where spark refers to giving life to static plots

            Comment

            Working...
            X