Terprint Visuals

Every strain has a print.

Ten well-known strains. Each terpene keeps its place and its colour, so what sets one strain apart shows at a glance. Example numbers in the range lab reports show; real batches vary.

One line on your page:

<script src="https://visuals.terprint.com/v1/terprint-visuals.min.js" defer></script>

Terprint Visuals draws terpene and cannabinoid lab results as small graphics for any web page. Add the script, then describe each graphic in an attribute. No build step, no account, no charge.

01

Start

Add the script once, anywhere on the page. Then put an element where a graphic should go. The top row of the wall above is this:


      

Amounts are percentages by weight, as a lab report gives them. Names can be written the way your lab writes them: Myrcene, beta-Myrcene and β-Myrcene are the same terpene.

02

Terpene band

terpene-band

Thirty terpenes, each always in the same place and the same colour, so two products can be compared at a glance. The stronger the colour, the more of that terpene.


      

Leave the empty places out when space is short:


      
cell
Largest cell size in pixels. Cells shrink to fit the element. Default 20.
showValues
Print the amount inside each cell that is big enough to hold it.
hideEmpty
Draw only the terpenes present.
solidAt
The percentage at which a cell is fully solid. Default 0.5, which suits flower. Use 2 for vapes and concentrates.

A terpene your source names without an amount can be given as null. Its cell is drawn half-strength and says so on hover.

03

Cannabinoid band

cannabinoid-band

Eleven cannabinoids in fixed places. Each is shaded against its own usual ceiling, so 1% CBG shows as clearly as 25% THC. It lines up under a terpene band of the same width.


      

Takes cell, showValues and hideEmpty. Δ9-THC, delta-9 THC and THC are the same cell.

04

Likeness

likeness

How alike are two products? Give it both lab profiles. The ring is the overall score. The bars are what the score is made of.


      
What the score counts
Terpene orderDo they share the same terpenes, and do those rank the same way round?45
Terpene amountHow close are the amounts of the terpenes they share?25
Cannabinoid orderThe same question, for cannabinoids. THCA and THC count together.15
Cannabinoid amountHow close are those amounts?15

Sources publish different depths. Up to ten top terpenes are compared; if one product lists only three, three are compared, and the first row of the graphic says so. Have a score of your own? Pass the numbers instead:


      

Options: height in pixels (default 48) and layout, where "ring" draws the ring alone.

05

Radar

terpene-radar

The shape of a terpene profile: the ten largest terpenes, one spoke each. Needs at least three.


    
06

Donut

cannabinoid-donut

What the cannabinoids add up to, and what share each one is.


      

Options: size in pixels and label, the word under the total.

07

Try it

Change the numbers. The graphic and the code to paste follow.


        
08

Colours

Every terpene and cannabinoid has one colour and one place, in the order below. They follow the Cannabis Data Exchange Standard (CDES), so a band drawn here matches a band drawn anywhere else that uses it.

      09

      From script

      Everything the attributes do is also a function on TerprintVisuals.

      // draw into an element: mount(element or selector, kind, values, options)
      TerprintVisuals.mount('#profile', 'terpene-band', { Myrcene: 0.82, Limonene: 0.33 }, { showValues: true });
      
      // draw every data-terprint element again, after adding some to the page
      TerprintVisuals.mountAll();
      
      // the likeness numbers without the drawing
      const like = TerprintVisuals.compareProfiles(
        { terpenes: { Myrcene: 0.82, Limonene: 0.33 }, cannabinoids: { THCA: 27.1 } },
        { terpenes: { Limonene: 0.71, Myrcene: 0.24 }, cannabinoids: { THCA: 24.6 } }
      );
      like.score;          // 0 to 100
      like.terpeneOrder;   // and terpeneAmount, cannabinoidOrder, cannabinoidAmount

      As a module:

      <script type="module">
        import { mount } from 'https://visuals.terprint.com/v1/terprint-visuals.esm.js';
        mount('#profile', 'cannabinoid-band', { THCA: 24.6, CBGA: 1.4 });
      </script>

      For full control the renderer classes are there too: ColorBandRenderer, RadarRenderer, DonutRenderer, LikenessRenderer. D3 is inside the file; there is nothing else to load.

      /v1/
      Gets fixes and new graphics. Nothing that works today will stop working.
      /1.1.0/
      This exact version. Never changes.
      10

      Terms

      Free for any site, commercial ones included, under the MIT licence. Keep the notice at the top of the file.

      No tracking. The script sets no cookies and sends nothing anywhere. This site has no analytics either.

      You supply the numbers. The graphics show lab results as you give them. They make no claim about what a product does.

      Missing a graphic, or found one drawing something wrong? Tell us.