Is there a bar chart with more than one color in any bar? RRS feed

  • Question

  • I know there are bar charts where maybe 3 values are plotted again and again over the x-axis, so you would have 3 bars of different colors at point 1, and then 3 bars of the same triplet of colors at point 2, etc.

    But I want to save space so:

    I want to make bar charts as follows:

    Each bar would be the same height but
    The Y-axis would have 5 values, and at each y-value, the  bar could take on a different color (or the same color).
    So, for example, if I was using "gray scale", and I wanted to say that  a lot happened at value #3, then I would use the color black at value #3.  If very little happened, I might use a very light scale of gray.   (and of course intermediate values would have intermediate shades of gray).
    So the bar would be divided into 5 areas, each which could have any shade of gray, or black, or white.
    In addition, I would want the user to be able to see a 3rd dimension of the bar, which would be how thick it is.
    To sum up, I want to have:
    1. multiple areas within a bar

    2. 3d bar charts.
    3. I want to do this in asp.net, which does have a web control, but I don't know if its the same as in stand-alone vb.net.


    Friday, November 7, 2014 7:04 PM

All replies

  • Is this what you mean?

    Imports System.Windows.Forms.DataVisualization.Charting
    ' Populate series data
    Dim random As New Random()
    Dim pointIndex As Integer
    For pointIndex = 0 To 9
        Chart1.Series("LightBlue").Points.AddY(random.Next(45, 95))
    Next pointIndex
    ' Set chart type
    Chart1.Series("LightBlue").ChartType = SeriesChartType.StackedArea100
    ' Show point labels
    Chart1.Series("LightBlue").IsValueShownAsLabel = True
    ' Disable X axis margin
    Chart1.ChartAreas("Default").AxisX.IsMarginVisible = False
    ' Set the first two series to be grouped into Group1
    chart1.Series("LightBlue")("StackedGroupName") = "Group1";
    chart1.Series("Gold")("StackedGroupName") = "Group1";
    ' Set the last two series to be grouped into Group2
    chart1.Series("Red")("StackedGroupName") = "Group2";
    chart1.Series("DarkBlue")("StackedGroupName") = "Group2";
    ' Show the chart in 3D
    Chart1.ChartAreas("Default").Area3DStyle.Enable3D = True

    Sunday, November 9, 2014 1:56 PM
  • PS Get the samples environment for chart control it has lots of info.
    Sunday, November 9, 2014 2:03 PM