Bunifu Framework Docs
HomePricingFAQsMy Account
  • Introduction
  • Getting started
    • Requirements
    • Installation
    • Installing for .Net 5 & Above
    • Licensing
      • Managing your licenses
      • Bunifu Licensing CLI
      • Bunifu Device Remover (Deprecated)
  • BUNIFU UI
    • Controls
      • Bunifu Button
      • Bunifu Button (variant)
      • Bunifu Cards
      • Bunifu CheckBox
      • Bunifu Circle Progress
      • Bunifu Datagrid View
      • Bunifu Date Picker
      • Bunifu Drop Down
      • Bunifu Flat Button
      • Bunifu Form Caption Button
      • Bunifu Form Control Box
      • Bunifu Form Resize Icon
      • Bunifu Gradient Panel
      • Bunifu Icon Button
      • Bunifu Image Button (New)
      • Bunifu Image Button (Old)
      • Bunifu IOS Switch (1.5.3)
      • Bunifu Label
      • Bunifu Loader
      • Bunifu Picture Box
      • Bunifu Pages
      • Bunifu Panel
      • Bunifu Progress Bar
      • Bunifu Radial Gauge
      • Bunifu Radio Button
      • Bunifu Rating
      • Bunifu Range
      • Bunifu Separator
      • Bunifu Sliders
      • Bunifu Shadow Panel
      • Bunifu Shapes
      • Bunifu Switch (1.5.3)
      • Bunifu ScrollBars
      • Bunifu Toggle Switch
      • Bunifu Toggle Switch (variant)
      • Bunifu Tile Button
      • Bunifu Thin Button (1.5.3)
      • Bunifu ToolTip
      • Bunifu Textbox
      • Bunifu User Control
    • Components
      • Bunifu Color Transition
      • Bunifu Drag
      • Bunifu Elipse [Deprecated]
      • Bunifu Form Dock
      • Bunifu Form Drag
      • Bunifu Form Resizer
      • Bunifu Snackbar
      • Bunifu Transition
  • BUNIFU CHARTS
    • Introduction
      • Quick Tips
    • Chart Components
      • Bunifu Bar Chart
      • Bunifu Bubble Chart
      • Bunifu Canvas Control
      • Bunifu Doughnut Chart
      • Bunifu Horizontal bar Chart
      • Bunifu Line Chart
      • Bunifu Pie chart
      • Bunifu Polar Chart
      • Bunifu Radar Chart
  • BUNIFU DATAVIZ [Deprecated]
    • Basic Charts [Deprecated]
      • Step Line Chart [Deprecated]
      • Step Area Chart [Deprecated]
      • Spline Chart [Deprecated]
      • Pie Chart [Deprecated]
      • Line Chart [Deprecated]
      • Doughnut Chart [Deprecated]
      • Bar Chart [Deprecated]
      • Area Chart [Deprecated]
      • Column Chart [Deprecated]
    • Advanced Charts [Deprecated]
      • Stacked Column 100 Chart [Deprecated]
      • Stacked Column Chart [Deprecated]
      • Stacked Bar Chart 100 [Deprecated]
      • Stacked Bar Chart [Deprecated]
      • Stacked Area Chart 100 [Deprecated]
      • Stacked Area Chart [Deprecated]
      • Scatter Chart [Deprecated]
      • Range Spline Area Chart [Deprecated]
      • Range Column Chart [Deprecated]
      • Range Bar Chart [Deprecated]
      • Range Area Chart [Deprecated]
      • OHLC Chart [Deprecated]
      • Candle Stick Chart [Deprecated]
      • Bubble Chart [Deprecated]
Powered by GitBook
On this page

Was this helpful?

  1. BUNIFU DATAVIZ [Deprecated]
  2. Advanced Charts [Deprecated]

Stacked Bar Chart [Deprecated]

Stacked bar chart visualizes a horizontal representation of stacked bar charts. Stacked bar charts are best for comparison purposes

How to display stacked bar chart using Bunifu Dataviz

Simply locate Bunifu Dataviz control in your toolbox and drag it to the location on your form where you would like to display it.

We will use button click event handler to display our chart called render_stacked_bar

private void render_stacked_bar_Click(object sender, EventArgs e)
{
   
   var r = new Random(); 
   var canvas = new Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced.Canvas();
   
   var datapoint_low = new Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced.DataPoint(Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced._type.Bunifu_stackedBar);
   var datapoint_high = new Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced.DataPoint(Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced._type.Bunifu_stackedBar);   
   datapoint_low.addxy("new Date (2002, 11, 10)", r.Next(1000,2000).ToString());
   
   datapoint_low.addxy("new Date (2002, 11, 9)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 8)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 7)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 6)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 5)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 4)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 3)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 2)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 1)", r.Next(1000, 2000).ToString());
   
   datapoint_high.addxy("new Date (2002, 11, 10)", r.Next(1000,2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 9)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 8)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 7)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 6)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 5)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 4)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 3)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 2)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 1)", r.Next(1000, 2000).ToString());   
   
   // Add data sets to canvas   
   canvas.addData(datapoint_low);
   canvas.addData(datapoint_high); 
   
   //render canvas
   bunifuDataViz1.Render(canvas); 
}
Private Sub render_stacked_Bar_Click(sender As Object, e As System.EventArgs) Handles render_stackedBar.Click     Dim r as New Random;
   
   Dim canvas as New Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced.Canvas;
   
   Dim datapoint_low as Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced.DataPoint = New Bunifu.DataViz.DataPoint (Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced._type.Bunifu_stackedBar);   
   Dim datapoint_high as Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced.DataPoint = New Bunifu.DataViz.DataPoint (Bunifu.Dataviz.WinForms.BunifuDatavizAdvanced._type.Bunifu_stackedBar);      
   
   datapoint_low.addxy("new Date (2002, 11, 10)", r.Next(1000,2000).ToString());   
   datapoint_low.addxy("new Date (2002, 11, 9)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 8)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 7)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 6)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 5)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 4)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 3)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 2)", r.Next(1000, 2000).ToString());
   datapoint_low.addxy("new Date (2002, 11, 1)", r.Next(1000, 2000).ToString());
   
   datapoint_high.addxy("new Date (2002, 11, 10)", r.Next(1000,2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 9)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 8)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 7)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy(”new Date (2002, 11, 6)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 5)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 4)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 3)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 2)", r.Next(1000, 2000).ToString());
   datapoint_high.addxy("new Date (2002, 11, 1)", r.Next(1000, 2000).ToString());   
   
   // Add data sets to canvas   
   canvas.addData(datapoint_low); 
   canvas.addData(datapoint_high);    
   
   //Render the canvas in the Data Viz 
   bunifuDataViz1.Render(canvas);
    
End Sub 

In order to display stacked bar chart we need the following controls:

  • Bunifu Data Viz - This is the container for our chart

  • Bunifu Canvas - This is the middle layer between the data viz (container) and the dataset

  • Bunifu Data Point - This will contain the data that we want to represent as pairs of X and Y coordinates

Bunifu Stacked Bar simply works by creating 2 data point objects, one for the “low” set of points and one for the “high” set of points. The control will know automatically to adjust the width of the lines to match the specified data points

On running the code you should see something like this:

That's it!

We hope Bunifu Dataviz will help you bring out the best data visualization for your data in your application.

Should you have feedback or suggestions please send us via chat on the bottom right corner of the screen.

PreviousStacked Bar Chart 100 [Deprecated]NextStacked Area Chart 100 [Deprecated]

Last updated 4 years ago

Was this helpful?