Skip to content
MermaidViewer

AI bar chart generator

AI bar chart generator that writes a Mermaid XY chart from categories and numbers. Line charts work too.

By MermaidViewer editorsPublished Updated

Free · 5 uses total, not a daily refill. No sign-up.

Example prompts for a xy chart (bar & line)

  • “Quarterly revenue vs target for 2026”
  • “Average page load time per release”
  • “Daily steps over a week”

What a Mermaid xy chart (bar & line) looks like

Example xy chart (bar & line)

Example xy chart (bar & line) diagram
mermaid
xychart
    title "Monthly active users (thousands)"
    x-axis [Jan, Feb, Mar, Apr, May, Jun]
    y-axis "Users" 0 --> 120
    bar [32, 41, 55, 68, 83, 101]
    line [32, 41, 55, 68, 83, 101]
Open in the live editor

Want to write it by hand? See the full Mermaid xy chart (bar & line) syntax and examples, or browse templates.

The tallest bar is the one an axis clips, and an ai bar chart generator will do that whenever the y maximum is a round number below your data. Support volume, monthly rain, CI minutes: you want categories in order and a scale that contains the largest value. The widget above writes Mermaid XY chart source. This page is about the nouns that keep months in order, the drafts that draw a line through the wrong length of list, and the one-number edits that should stay manual.

Bars it draws without drama

Categories you list in order usually stay in order. A single bar series is the reliable part. A title in quotes survives parentheses better than a bare title. A y-axis label and a range appear when you say "tickets, from 0 to 600." Horizontal bars appear when you say horizontal, which helps when the category names are long, like release names.

A second series as a line works when you call it a target or a trend and you give the same number of values as there are categories. The bar chart syntax lives under the XY chart keyword. The safe first line is xychart-beta, which still renders on Mermaid builds that have not dropped the beta name. You can add a line later. Start with bars if the prompt is already doing a lot.

The chart will not choose a meaningful scale for you. "Nice" maximums are how the tallest bar loses its head. Say the maximum.

What gets clipped, reordered, or mismatched

The y-axis says 0 --> 100 while a bar is 140. The bar paints past the frame or gets cut, and the chart looks calm. Months arrive as Jan, Mar, Feb because the model sorted them or followed a sentence that mentioned March first. The bar list and the line list have different lengths, so the series do not share categories. A title with a colon or a parenthesis and no quotes breaks the title line.

Horizontal mode flips the axis you meant. You asked for months along the bottom and received a ranking chart. Values get converted to percentages even though you said counts. Zero is omitted and the axis starts at 40, which exaggerates a small change. Negative numbers, rare in these prompts, need a minimum below zero. The model often leaves the minimum at 0 and the bar disappears.

xychart without -beta is fine on current Mermaid and risky if you paste the same file into an older doc tool. Prefer the beta keyword when the chart has to travel.

Categories, values, and a maximum

Say the table, then the scale.

  • The title, in a short phrase.
  • The categories, in the order they must appear.
  • The bar values, in that same order, as counts or as the unit you name.
  • The y-axis label, the minimum, and a maximum above the largest value.
  • Whether a line series exists, with the same length, and what it means.
  • Horizontal or vertical, in one word.
  • "Do not rescale to percentages."

The revenue bar chart template pairs monthly recurring revenue bars with a target line. Generate a new chart for tickets, rain, or build times. Open the template when the update is this month's revenue against plan. The prompt guide explains AI edit versus typing. On bar charts, "set the max above the tallest bar" is the edit that fixes a clipped chart.

Three prompts

  • Vertical bar chart titled Support tickets. Categories in this order: Mon, Tue, Wed, Thu, Fri. Values: 120, 140, 90, 160, 110. Y-axis label Tickets from 0 to 200. No line series. Do not convert to percentages. Use xychart-beta. Quote the title.
  • Vertical bar chart titled Spring rain. Categories Mar, Apr, May, Jun. Rainfall millimeters: 40, 55, 90, 70. Y-axis from 0 to 120 labeled mm. No second series. Keep month order. The maximum must stay above 90.
  • Horizontal bar chart titled CI minutes. Categories web, api, ios, android. Values 18, 22, 41, 37. X-axis is the category list. The value axis runs from 0 to 50 and is labeled minutes. No trend line. Do not sort the categories by size.

A week that fits on the axis

Friday is 110 and the axis goes to 200, so Thursday's 160 still has headroom. The order is the week, not the size of the bars.

Mermaid diagram
mermaid
xychart-beta
    title "Support tickets"
    x-axis [Mon, Tue, Wed, Thu, Fri]
    y-axis "Tickets" 0 --> 200
    bar [120, 140, 90, 160, 110]
Open in the live editor

Open the editor and change Thursday from 160 to 180 if a bad deploy landed. If 180 is still under 200, the axis can stay. If a later week hits 240, raise the maximum in the same edit. Leaving the maximum at 200 would clip the new bar.

Unclipping a chart

Use an AI edit when the axis, the order, and the series length are all wrong. "Vertical bars. Categories Mon Tue Wed Thu Fri in that order. Values 120, 140, 90, 160, 110. Y-axis Tickets from 0 to 200. Delete the line series. Use xychart-beta and quote the title." That is one structural repair. It is worth a generation.

Change a value by hand when the frame is right. Edit 160 to 180. Raise 200 to 250. Add a category and a matching value together, so the lists stay the same length. Remove horizontal if the model flipped a chart you wanted upright. Hand editing stays free. A bar chart source is a handful of lines. Regenerating it to fix Thursday is how you spend the free pool on a typo.

If the preview fails, count the commas. The bar list must have one number per x-axis category. A title with a parenthesis needs quotes. Fix those in the editor before you ask for another draft.

Allowance and the two paid plans

There are five free AI uses in total. They are not replaced each day. The account, the IP address, and a device cookie share them, across every diagram type on the site. A bar chart is often correct on the first generation if you included the maximum. It needs a second generation when the axis clips or the months shuffle. Take the second pass for that. Then type.

Starter is $6.99 a month and includes 500 AI conversations a month. Pro is $11.99 a month and includes unlimited AI under fair use, which is a human pace of diagramming with a ceiling on abuse. Hand editing stays free after the five uses are spent. PNG download stays on every plan: 1× with a watermark on Free, up to 4× on Starter, up to 8× on Pro. JPG, SVG, and PDF are on Pro. A weekly ticket chart can live in the editor and change five numbers every Monday.

A pie is a share of one total. A bar chart is a comparison across categories, and it can carry a second series. The AI diagram generator index links both. Use this page when the order of the categories is part of the meaning.

Frequently asked questions

How do I generate a xy chart (bar & line) with AI?

Describe the xy chart (bar & line) you need in the box above and click Generate. The AI writes valid Mermaid xy chart (bar & line) code that renders instantly, and you can open it in the editor to refine it.

Is the AI xy chart (bar & line) generator free?

You can try it free: 5 AI generations in total, not per day, with no sign-up. Starter includes 500 AI conversations a month and Pro is unlimited. Manual editing stays available, and every plan can still download a PNG. JPG, SVG and PDF are on Pro.

Can I edit the generated xy chart (bar & line)?

Absolutely. The output is plain Mermaid code — edit it by hand in the live editor, or ask the AI for changes in natural language.

Other AI generators