What is an XY Chart?
Mermaid’s An XY chart is a versatile data visualization tool used to represent data with two variables on x-axis and y-axis. It currently supports two main chart types:- Bar Chart: Displays data as rectangular bars.
- Line Chart: Connects data points with a line.
Creating Your First XY Chart
Steps:
- Launch DinoAI: From Code IDE, access DinoAI to start creating diagrams.
- Use a Simple Prompt: Tell DinoAI what kind of XY Chart you want to create. For example:
- Get Your Diagram: DinoAI will generate a complete
.mmdfile with proper Mermaid syntax. - Preview Your Work: Click the eye icon (👁️) to preview your diagram in real-time as you edit.
- Iterate and Refine: Modify the generated
.mmdfile directly, or ask DinoAI to make specific changes.
Example:
Reusable XY Charts prompts for you and your teamYou can create custom, standardized .dinoprompts for Mermaid’s XY Charts that ensure consistency across your data team. See step-by-step guide.
Syntax Guide
Title
The chart title is added using thetitle keyword:
X-Axis
The x-axis can represent categories or a numerical range:- Categorical:
[cat1, cat2, ...] - Numerical:
"title" min --> max
Y-Axis
The y-axis represents numerical values only:"title" min --> max
Chart Types
- Bar Chart: Use
bar [data values]. - Line Chart: Use
line [data values].
Example:
Advanced Features
Orientation
Change the chart orientation to horizontal:Configuration Options
Customize your chart using parameters like width, height, or axis labels:Theming
Adjust chart colors and styles usingthemeVariables:
Practical Example: Monthly Sales Revenue
Best Practices
- Use descriptive titles for clarity.
- Ensure axis ranges accommodate your data.
- Choose appropriate chart types for data representation.
- Use themes to make charts visually appealing.
Additional ResourcesFor more syntax options and advanced features, visit the official Mermaid documentation.