Implementation guide · Static HTML and CSS output

Embed a CSS Bar Chart and Reopen Its Barmark JSON

A small comparison chart can travel as ordinary HTML and CSS. Barmark turns one to twelve labeled, nonnegative values into a horizontal bar graph with visible numbers and a shared zero baseline. This guide follows a five-row example, explains how scale changes the picture and shows which files to keep for embedding or later editing.

Open the complete free editor

The full core package is free: the local editor, chart component, standalone HTML, CSV export and JSON save/reopen workflow are included. No account, chart library, server or payment is required. Download it from the product page, extract the ZIP and open app/index.html in a modern browser. Keep the app and samples folders together.

The supplied samples/workshops.html is a ready-to-open standalone chart. Its companion samples/workshops.barmark.json is the editable project. You can inspect those before entering your own data. Setup documentation is included; guaranteed support and an update schedule are outside the offer.

Build a comparison with a meaningful scale

Edit the title, caption, unit, accent and category/value rows. In the current independently checked example, the saved project used the title Neighborhood sessions, the caption Fictional bookings · One shared zero baseline, the unit people and accent #8C4E32. After sorting, its rows were:

With a fixed maximum of 100, these produce colored widths of 100%, 75%, 50%, 25% and 0% of the bar track. The displayed percentage widths describe the drawing; the values still mean people. Keep the unit and visible numbers clear so readers do not mistake your values for percentage inputs.

Automatic scale uses the largest value. A fixed maximum lets multiple charts use the same scale, but it must be positive and at least as large as every value. All-zero data uses a 0–1 automatic scale and exactly zero-width colored bars, with the zeros still visible as text.

Use Sort by value to order the rows, or add and remove rows within the twelve-row limit. Barmark accepts finite nonnegative numbers up to 1,000,000,000 with at most six decimal places. It does not provide negative values, percentage inputs, a date axis, stacked series or statistical analysis. A very small value beside a much larger one can produce a tiny bar; retain the number rather than exaggerating its colored width.

Save the project before choosing an output

Use Save project to download the complete editable JSON state. There is no autosave. Then change a value or title and use Open project to select the actual saved file. Check the title, caption, unit, accent, scale and rows after reopening.

Invalid fields preserve the last valid chart and block export until corrected. Malformed or invalid project input also preserves the current output. Correct the field or choose a valid saved Barmark project rather than treating a standalone HTML chart or CSV file as an importable project.

Embed the component with its scoped stylesheet

Download the stylesheet as barmark.css and include it once in your page’s head. Then paste Copy HTML, or the downloaded HTML component, into the page body. For a site that stores the CSS beside the consuming page, the stylesheet link is:

<link rel="stylesheet" href="barmark.css">

Adjust that path if your site puts CSS in an assets directory. Use the actual exported component rather than a screenshot of the editor. The component is a figure containing a table with a caption, column headers, scoped row labels and visible numeric text. The colored bar cells are decorative and marked aria-hidden.

The stylesheet is scoped to .bm-chart. Downloaded chart markup contains no scripts or remote resources, so the embedded chart does not need a JavaScript chart runtime. Keep the full exported table structure and class names together when integrating it into your page.

If browser clipboard access is unavailable, select the readonly code text or download the same files. Open your real consuming page at a wide and narrow viewport after adding the chart, because your host page’s styles and layout are part of the final result.

Choose standalone HTML, CSV or JSON for the recipient

The standalone HTML and CSV are outputs, not formats for reopening a project. Choose JSON when a colleague needs to revise rows, scale or styling in Barmark.

Review the data and the final page

The current independent output review opened the actual component with its actual stylesheet at 1200 and 375 pixels, with JavaScript disabled. It also checked that labels and values remained readable when CSS was disabled. That table structure is useful evidence of readable source; it is not whole-site accessibility certification or a substitute for testing your final page with its intended users and assistive technology.

Before sharing, compare every category and value against your source data, confirm the unit and scale, reopen the saved JSON and inspect the real exported file. The chart draws the numbers you provide; it does not verify your dataset or perform statistical analysis.

The offline editor keeps data in browser memory and explicitly downloaded files. It has no uploads, external fonts, analytics, cookies or browser storage. Its optional hosted adapter is inactive unless separately integrated. This guide collects no usage data.

The included license permits free personal and commercial project use and output sharing while restricting resale of the package. Open Barmark or download the complete free package and keep your editable JSON alongside the HTML/CSS handoff.