logo
  • Home
  • Modern
    New
  • eCommerce
  • Frontend pages
  • Homepage
  • About Us
  • Blog
  • Blog Details
  • Contact
  • Portfolio
  • Pricing
  • Apps
  • AI
  • Chat
  • Image
  • Contacts
    2
  • Blog
  • Posts
  • Detail
  • Create
  • Edit
  • Manage Blog
  • Ecommerce
  • Shop
  • Detail
  • List
  • Checkout
  • Add Product
  • Edit Product
  • Chats
  • Users
  • Profile
  • Followers
  • Friends
  • Gallery
  • Notes
  • Calendar
  • Email
  • Tickets
  • Kanban
  • Invoice
  • List
  • Details
  • Create
  • Edit
  • Orders
  • Customers
  • Pages
  • Integrations
  • API Keys
  • Roll Base Access
  • Pricing
  • Account Setting
  • FAQ
  • Tabler Icon
  • Sample Page
  • Landingpage
  • Widgets
  • Cards
  • Banners
  • Charts
  • Forms
  • Form Elements
  • Autocomplete
  • Button
  • Checkbox
  • Radio
  • Date Time
  • Slider
  • Switch
  • Form Layout
  • Form Horizontal
  • Form Vertical
  • Form Custom
  • Form Wizard
  • Form Validation
  • Tiptap Editor
  • Tables
  • Basic
  • Collapsible
  • Enhanced
  • Fixed Header
  • Pagination
  • Search
  • Tanstack / React Table
  • Basic
  • Dense
  • Filter
  • Row Selection
  • Pagination
  • Sorting
  • Column Visibility
  • Drag n Drop
  • Editable
  • Empty
  • Expand
  • Sticky
  • UI
  • Ui Components
  • Charts
  • Line
  • Gradient
  • Area
  • Candlestick
  • Column
  • Doughtnut & Pie
  • RadialBar & Radar
  • Mui Charts
  • BarCharts
  • LineCharts
  • Lines
  • Area
  • PieCharts
  • ScatterCharts
  • SparklineCharts
  • GaugeCharts
  • Mui Trees
  • SimpleTreeView
  • Items
  • Selection
  • Expansion
  • Customization
  • Focus
  • Auth
  • Login
  • Side Login
  • Boxed Login
  • Register
  • Side Register
  • Boxed Register
  • Forgot Password
  • Side Forgot Password
  • Boxed Forgot Password
  • Two Steps
  • Side Two Steps
  • Boxed Two Steps
  • Error
  • Maintenance
  • Other
  • Menu Level
  • Level 1
  • Level 1.1
  • Level 2
  • Level 2.1
  • Level 3
  • Level 3.1
  • Disabled
  • SubCaption
    This is the sutitle
  • Chip
    9
  • Outlined
    outline
  • External Link
Remy Sharp
Mathew
Designer

Bar Chart

  1. Home

  2. Bar Charts

breadcrumbImg
Simple Chart

  • Page Views
  • Visitors
Sample Code

            
'use client'
import * as React from 'react';
import { BarChart } from '@mui/x-charts/BarChart';
import { useTheme } from '@mui/material';

   const BCrumb = [
  {
    to: '/',
    title: 'Home',
  },
  {
    title: 'SimpleBarChart ',
  },
]; 

export default function SimpleBarChart() {

    const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490];
    const pData = [2400, 1398, 9800, 3908, 4800, 3800, 4300];
      const xLabels = [
    "Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6", "Week 7"
  ];

    const theme = useTheme();
    const primary = theme.palette.primary.main;
    const secondary = theme.palette.secondary.main;

    return (
      
            <BarChart
                height={300}
                borderRadius={6}
                series={[
                    { data: pData, label: 'Page Views', id: 'pvId', color: primary },
                    { data: uData, label: ' Visitors', id: 'uvId', color: secondary },
                ]}
                xAxis={[{ data: xLabels, scaleType: 'band', categoryGapRatio: 0.8,
                    barGapRatio: 0.8 }]}
            />
   
    );
}
Mixed Chart

  • Page Views
  • Visitors
  • Revenue
Sample Code

    
'use client'
import * as React from 'react';
import { BarChart } from '@mui/x-charts/BarChart';
import { useTheme } from '@mui/material';

const BCrumb = [
{
to: '/',
title: 'Home',
},
{
title: 'MixedBarChart ',
},
]; 
function MixedBarChart() {
    const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490];
    const pData = [2400, 1398, 9800, 3908, 4800, 3800, 4300];
    const amtData = [2400, 2210, 2290, 2000, 2181, 2500, 2100];

    const xLabels = [
    "Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6", "Week 7"
  ];
    const theme = useTheme();
    const primary = theme.palette.primary.main;
    const secondary = theme.palette.secondary.main;
    const light = theme.palette.success.main;

    return (
            <BarChart
               borderRadius={6}
                height={300}
                series={[
                    { data: pData, label: 'Page Views', stack: 'stack1', color: primary },
                    { data: amtData, label: ' Visitors', color: success },
                    { data: uData, label: 'Revenue ', stack: 'stack1', color: secondary },
                ]}
                xAxis={[{ data: xLabels, scaleType: 'band',categoryGapRatio: 0.8,
                    barGapRatio: 0.8 }]}
            />

    )
}

export default MixedBarChart
Positive And Negative Chart

  • Page Views
  • Visitors
Sample Code

            
'use client'
import * as React from 'react';
import { BarChart } from '@mui/x-charts/BarChart';
import { useTheme } from '@mui/material';

   const BCrumb = [
  {
    to: '/',
    title: 'Home',
  },
  {
    title: 'PositiveAndNegativeBarChart ',
  },
]; 


function PositiveAndNegativeBarChart() {
    const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490];
    const pData = [2400, 1398, -9800, 3908, 4800, -3800, 4300];

      const xLabels = [
    "Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6", "Week 7"
  ];
    const theme = useTheme();
    const primary = theme.palette.primary.main;
    const success = theme.palette.success.main;

    return (

            <BarChart
              
                height={300}
                borderRadius={6}
                series={[
                    {
                        data: pData,
                        label: 'Page Views',
                        color: primary
                    },
                    {
                        data: uData,
                        label: ' Visitors',
                        color: success
                    },
                ]}
                xAxis={[
                    {
                        data: xLabels,
                        scaleType: 'band',
                        categoryGapRatio: 0.8,
                        barGapRatio: 0.8
                    },
                ]}
                yAxis={[{ max: 10000 }]}
            />
    )
}

export default PositiveAndNegativeBarChart

StackedBySign Chart

  • Page Views
  • Visitors
Sample Code

  
'use client'
import React from 'react'
import { BarChart } from '@mui/x-charts/BarChart';
import { useTheme } from '@mui/material';


const BCrumb = [
{
to: '/',
title: 'Home',
},
{
title: 'BarChartStackedBySignChart ',
},
]; 


function BarChartStackedBySignChart() {
  const pData = [2400, 1398, -9800, 3908, 4800, -3800, 4300];
  const uData = [4000, -3000, -2000, 2780, -1890, 2390, 3490];

  const xLabels = [
    "Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6", "Week 7"
  ];
  const theme = useTheme();
  const primary = theme.palette.primary.main;
  const secondary = theme.palette.secondary.main;

  return (
   
      <BarChart
      borderRadius={6}
        height={300}
        series={[
          { data: pData, label: 'Page Views', id: 'pvId', stack: 'stack1', color: primary },
          { data: uData, label: 'Visitors', id: 'uvId', stack: 'stack1', color: secondary },
        ]}
        xAxis={[{ data: xLabels, scaleType: 'band' ,categoryGapRatio: 0.8,
          barGapRatio: 0.8}]}
      />
 
  )
}

export default BarChartStackedBySignChart

Biaxial Chart

  • Page Views
  • Visitors
Sample Code

  
'use client'
import * as React from 'react';
import { BarChart } from '@mui/x-charts/BarChart';
import { useTheme } from '@mui/material';

const BCrumb = [
{
to: '/',
title: 'Home',
},
{
title: 'BiaxialBarChart ',
},
]; 
function BiaxialBarChart() {
    const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490];
    const pData = [2400, 1398, 9800, 3908, 4800, 3800, 4300];

     const xLabels = [
      "Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6", "Week 7"
  ];

    const theme = useTheme();
    const primary = theme.palette.primary.main;
    const secondary = theme.palette.secondary.main;

    return (
            <BarChart
              borderRadius={6}
                height={300}
                series={[
                    {
                        data: pData,
                        label: "Page Views",
                        id: "pvId",
                        color: primary,

                        yAxisId: "leftAxisId",
                    },
                    {
                        data: uData,
                        label: "Visitors",
                        id: "uvId",
                        color: secondary,

                        yAxisId: "rightAxisId",
                    },
                ]}
                xAxis={[{ data: xLabels, scaleType: "band",categoryGapRatio: 0.8,
                    barGapRatio: 0.8 }]}
                yAxis={[{ id: "leftAxisId" }, { id: "rightAxisId" }]}
            
            />
    );
}

export default BiaxialBarChart;

Stacked Chart

  • Page Views
  • Visitors
Sample Code

"use client"

import React from "react";
import { BarPlot, ChartContainer } from "@mui/x-charts";
import { useTheme } from "@mui/material/styles";

const BCrumb = [
{
to: '/',
title: 'Home',
},
{
title: 'StackedBarChart ',
},
];

function StackedBarChart() {

    const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490];
    const pData = [2400, 1398, 9800, 3908, 4800, 3800, 4300];
      const xLabels = [
    "Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6", "Week 7"
  ];

    const theme = useTheme();
    const primary = theme.palette.primary.main;
    const secondary = theme.palette.secondary.main;

    return (
      
            <BarChart
                height={300}
                borderRadius={6}
                series={[
                    { data: pData, label: 'Page Views', id: 'pvId', stack: 'total', color: primary },
                    { data: uData, label: 'Visitors', id: 'uvId', stack: 'total', color: secondary },
                ]}
                xAxis={[{ data: xLabels, scaleType: 'band',categoryGapRatio: 0.8,
                    barGapRatio: 0.8 }]}
            />
    
    )
}

export default StackedBarChart;
Tiny Chart

Sample Code

     "use client"

    import React from "react";
    import { BarPlot, ChartContainer } from "@mui/x-charts";
    import { useTheme } from "@mui/material/styles";

   const BCrumb = [
  {
    to: '/',
    title: 'Home',
  },
  {
    title: 'TinyBarChart ',
  },
];

const TinyBarChart = () => {
    
    const theme = useTheme();
    const primary = theme.palette.primary.main;

    const uData = [4000, 3000, 2000, 2780, 1890, 2390, 3490];
      const xLabels = [
    "Week 1", "Week 2", "Week 3", "Week 4", "Week 5", "Week 6", "Week 7"
  ];

    return (
    
            <ChartContainer
                width={500}
                height={300}
                series={[{
                    data: uData,
                    label: 'uv',
                    type: 'bar',
                    color: primary
                }]}
                xAxis={[{ data: xLabels, scaleType: 'band',categoryGapRatio: 0.8,
                 barGapRatio: 0.8, }]}
            >
            <BarPlot borderRadius={6} />
            </ChartContainer>
       
    );
};

export default TinyBarChart;