logo
down
shadow

How to add background colors to category groupings in Highcharts


How to add background colors to category groupings in Highcharts

By : Coldman
Date : November 21 2020, 07:31 AM
I wish this helpful for you You can use the alternateGridColor option on xAxis:
code :
"xAxis": {
    "categories": [
      "Category 1",
      "Category 2",
      "Category 3",
      "Category 4",
      "Category 5",
      "Category 6"
    ],
    "opposite": true,
     alternateGridColor: '#CCC'


Share : facebook icon twitter icon
Highcharts Bar Graph Remove Category when all bar values for category equal 0

Highcharts Bar Graph Remove Category when all bar values for category equal 0


By : Hamza Azil
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , You would need to filter the data before initializing the chart like so:
code :
var data = [{
    name: 'Year 1800',
    data: [0, 0, 0, 0, 0]
}, {
    name: 'Year 1900',
    data: [0, 156, 947, 408, 6]
}, {
    name: 'Year 2008',
    data: [0, 914, 4054, 732, 34]
}];

data = $.grep(data, function (category) {
    return $.grep(category.data, function (item) {
        return item > 0;
    }).length > 0;
});
Set Chart Series Colors to Match Category Cell Colors VBA

Set Chart Series Colors to Match Category Cell Colors VBA


By : h.alijan
Date : March 29 2020, 07:55 AM
To fix the issue you can do Assuming that I understand exactly what you are asking, you were very close to being there. I think the issue in your code was how you were splitting the series formula to get the label color.
I turned this chart, with column headers colored as such:
code :
Sub SetColors()

Dim oChart As ChartObject
Dim MySeries As Series

For Each oChart In ActiveSheet.ChartObjects

    For Each MySeries In oChart.Chart.SeriesCollection

        Dim sFormula As String
        sFormula = Split(MySeries.Formula, ",")(0) 'this returns the =SERIES(Sheet!RC part of the formula, the first argument is the series label
        sFormula = Split(sFormula, "(")(1) 'this removes the =SERIES(  leaving only the column label range (Sheet!RC)

        Dim lSourceColor As Long
        lSourceColor = Range(sFormula).Interior.Color

        With MySeries
            .Interior.Color = lSourceColor
            .Border.Color = lSourceColor
            '.MarkerBackgroundColorIndex = lSourceColor
            '.MarkerForegroundColorIndex = lSourceColor
            .MarkerBackgroundColor = lSourceColor
            .MarkerForegroundColor = lSourceColor
            With .Format.Line
                .ForeColor.RGB = lSourceColor
                .BackColor.RGB = lSourceColor
            End With
            .Format.Fill.ForeColor.RGB = lSourceColor
        End With

    Next

Next

End Sub
Excel VBA - collection/dictionary? how to create unique parent-children category groupings?

Excel VBA - collection/dictionary? how to create unique parent-children category groupings?


By : Maxwell Bruckhaus
Date : March 29 2020, 07:55 AM
should help you out I'm going to assume you have three ListObjects on three sheets in an Excel Workbook.
Sheet1 (tblParent)
code :
Item
A
B
C
Item    Parent
z       A
y       A
w       B
m       C
n       C
o       C
p       C
Grain       Parent  Data1   Data2   Data3
y.g1.g2.g3  y       0       TRUE    1/2/1970
w.g1.g2.g3  w       0       TRUE    9/5/1980
m.g1.g2.g3  m       100     TRUE    1/1/1949
n.g1.g2.g3  n       2       TRUE    1/1/1950
Private mcolParents As Collection

Private Sub Class_Initialize()
    Set mcolParents = New Collection
End Sub

Private Sub Class_Terminate()
    Set mcolParents = Nothing
End Sub

Public Property Get NewEnum() As IUnknown
    Set NewEnum = mcolParents.[_NewEnum]
End Property

Public Sub Add(clsParent As CParent)
    If clsParent.ParentID = 0 Then
        clsParent.ParentID = Me.Count + 1
    End If

    mcolParents.Add clsParent, CStr(clsParent.ParentID)
End Sub

Public Property Get Parent(vItem As Variant) As CParent
    Set Parent = mcolParents.Item(vItem)
End Property

Public Property Get Count() As Long
    Count = mcolParents.Count
End Property


Public Sub FillFromRange(ByRef rParents As Range, ByRef rChildren As Range, ByRef rGrains As Range)

    Dim vaParents As Variant
    Dim i As Long
    Dim clsParent As CParent

    vaParents = rParents.Value

    For i = LBound(vaParents, 1) To UBound(vaParents, 1)
        Set clsParent = New CParent
        With clsParent
            .Name_ = vaParents(i, 1)
        End With
        Me.Add clsParent

        clsParent.Children.FillFromRange rChildren, clsParent.Name_, rGrains

    Next i

End Sub
Private mlParentID As Long
Private msName_ As String
Private mclsChildren As CChildren

Public Property Set Children(ByVal clsChildren As CChildren): Set mclsChildren = clsChildren: End Property
Public Property Get Children() As CChildren: Set Children = mclsChildren: End Property
Public Property Let ParentID(ByVal lParentID As Long): mlParentID = lParentID: End Property
Public Property Get ParentID() As Long: ParentID = mlParentID: End Property
Public Property Let Name_(ByVal sName_ As String): msName_ = sName_: End Property
Public Property Get Name_() As String: Name_ = msName_: End Property

Private Sub Class_Initialize()
    Set mclsChildren = New CChildren
End Sub

Private Sub Class_Terminate()
    Set mclsChildren = Nothing
End Sub
Private mcolChildren As Collection

Private Sub Class_Initialize()
    Set mcolChildren = New Collection
End Sub

Private Sub Class_Terminate()
    Set mcolChildren = Nothing
End Sub

Public Property Get NewEnum() As IUnknown
    Set NewEnum = mcolChildren.[_NewEnum]
End Property

Public Sub Add(clsChild As CChild)
    If clsChild.ChildID = 0 Then
        clsChild.ChildID = Me.Count + 1
    End If

    mcolChildren.Add clsChild, CStr(clsChild.ChildID)
End Sub

Public Property Get Child(vItem As Variant) As CChild
    Set Child = mcolChildren.Item(vItem)
End Property

Public Property Get Count() As Long
    Count = mcolChildren.Count
End Property

Public Sub FillFromRange(ByRef rRng As Range, ByVal sParentName As String, ByRef rGrains As Range)

    Dim vaValues As Variant
    Dim i As Long
    Dim clsChild As CChild

    vaValues = rRng.Value

    For i = LBound(vaValues, 1) To UBound(vaValues, 1)
        If vaValues(i, 2) = sParentName Then
            Set clsChild = New CChild
            With clsChild
                .Name_ = vaValues(i, 1)
            End With
            Me.Add clsChild

            clsChild.Grains.FillFromRange rGrains, clsChild.Name_
        End If
    Next i

End Sub
Private mlChildID As Long
Private msName_ As String
Private mclsGrains As CGrains

Public Property Set Grains(ByVal clsGrains As CGrains): Set mclsGrains = clsGrains: End Property
Public Property Get Grains() As CGrains: Set Grains = mclsGrains: End Property
Public Property Let ChildID(ByVal lChildID As Long): mlChildID = lChildID: End Property
Public Property Get ChildID() As Long: ChildID = mlChildID: End Property
Public Property Let Name_(ByVal sName_ As String): msName_ = sName_: End Property
Public Property Get Name_() As String: Name_ = msName_: End Property

Private Sub Class_Initialize()
    Set mclsGrains = New CGrains
End Sub

Private Sub Class_Terminate()
    Set mclsGrains = Nothing
End Sub
Private mcolGrains As Collection

Private Sub Class_Initialize()
    Set mcolGrains = New Collection
End Sub

Private Sub Class_Terminate()
    Set mcolGrains = Nothing
End Sub

Public Property Get NewEnum() As IUnknown
    Set NewEnum = mcolGrains.[_NewEnum]
End Property

Public Sub Add(clsGrain As CGrain)
    If clsGrain.GrainID = 0 Then
        clsGrain.GrainID = Me.Count + 1
    End If

    mcolGrains.Add clsGrain, CStr(clsGrain.GrainID)
End Sub

Public Property Get Grain(vItem As Variant) As CGrain
    Set Grain = mcolGrains.Item(vItem)
End Property

Public Property Get Count() As Long
    Count = mcolGrains.Count
End Property

Public Sub FillFromRange(ByRef rRng As Range, ByVal sChildName As String)

    Dim vaValues As Variant
    Dim i As Long
    Dim clsGrain As CGrain

    vaValues = rRng.Value

    For i = LBound(vaValues, 1) To UBound(vaValues, 1)
        If vaValues(i, 2) = sChildName Then
            Set clsGrain = New CGrain
            With clsGrain
                .Data1 = vaValues(i, 3)
                .Data2 = vaValues(i, 4)
                .Data3 = vaValues(i, 5)
            End With
            Me.Add clsGrain
        End If
    Next i

End Sub
Private mlGrainID As Long
Private mlData1 As Long
Private mbData2 As Boolean
Private mdtData3 As Date

Public Property Let GrainID(ByVal lGrainID As Long): mlGrainID = lGrainID: End Property
Public Property Get GrainID() As Long: GrainID = mlGrainID: End Property
Public Property Let Data1(ByVal lData1 As Long): mlData1 = lData1: End Property
Public Property Get Data1() As Long: Data1 = mlData1: End Property
Public Property Let Data2(ByVal bData2 As Boolean): mbData2 = bData2: End Property
Public Property Get Data2() As Boolean: Data2 = mbData2: End Property
Public Property Let Data3(ByVal dtData3 As Date): mdtData3 = dtData3: End Property
Public Property Get Data3() As Date: Data3 = mdtData3: End Property
Public gclsParents As CParents

Public Sub Initialize()

    Set gclsParents = New CParents
    gclsParents.FillFromRange Sheet1.ListObjects(1).DataBodyRange, Sheet2.ListObjects(1).DataBodyRange, Sheet3.ListObjects(1).DataBodyRange

End Sub
Public Sub ListChildren()

    Dim sh As Worksheet
    Dim vaWrite As Variant

    If gclsParents Is Nothing Then Initialize

    Set sh = ThisWorkbook.Worksheets.Add
    vaWrite = gclsParents.ChildListToRange

    sh.Range("A1").Resize(UBound(vaWrite, 1), UBound(vaWrite, 2)).Value = vaWrite

End Sub
A   2   z,y
B   1   w
C   4   m,n,o,p
Public Property Get ChildListToRange() As Variant

    Dim aReturn() As Variant
    Dim clsParent As CParent
    Dim lCnt As Long

    ReDim aReturn(1 To Me.Count, 1 To 3)

    For Each clsParent In Me
        lCnt = lCnt + 1
        aReturn(lCnt, 1) = clsParent.Name_
        aReturn(lCnt, 2) = clsParent.Children.Count
        aReturn(lCnt, 3) = clsParent.ChildListDelimited(",")
    Next clsParent

    ChildListToRange = aReturn

End Property
Public Property Get ChildListDelimited(ByVal sDelim As String) As String

    Dim clsChild As CChild
    Dim aReturn() As String
    Dim lCnt As Long

    ReDim aReturn(1 To Me.Children.Count)

    For Each clsChild In Me.Children
        lCnt = lCnt + 1
        aReturn(lCnt) = clsChild.Name_
    Next clsChild

    ChildListDelimited = Join(aReturn, sDelim)

End Property
Public Sub SummarizeValues()

    Dim sh As Worksheet
    Dim vaWrite As Variant
    Dim clsToSum As CParents

    If gclsParents Is Nothing Then Initialize

    Set sh = ThisWorkbook.Worksheets.Add
    Set clsToSum = gclsParents.FilterByData2(True).FilterByData3(DateSerial(1950, 1, 1), ">=")
    vaWrite = clsToSum.SummarizeGrainValues

    sh.Range("A1").Resize(UBound(vaWrite, 1), UBound(vaWrite, 2)).Value = vaWrite

End Sub
    Public Property Get FilterByData2(ByVal lData As Long) As CParents

        Dim clsParent As CParent
        Dim clsNewParent As CParent
        Dim clsChild As CChild
        Dim clsReturn As CParents

        Set clsReturn = New CParents

        For Each clsParent In Me
            Set clsNewParent = New CParent
            clsNewParent.Name_ = clsParent.Name_
            Set clsNewParent.Children = clsParent.Children.FilterByData2(lData)
            If clsNewParent.Children.Count > 0 Then
                clsReturn.Add clsNewParent
            End If
        Next clsParent

        Set FilterByData2 = clsReturn

    End Property
Public Property Get FilterByData2(ByVal lData As Long) As CChildren

    Dim clsChild As CChild
    Dim clsNewChild As CChild
    Dim clsGrain As CGrain
    Dim clsReturn As CChildren

    Set clsReturn = New CChildren

    For Each clsChild In Me
        Set clsNewChild = New CChild
        clsNewChild.Name_ = clsChild.Name_
        Set clsNewChild.Grains = clsChild.Grains.FilterByData2(lData)
        If clsNewChild.Grains.Count > 0 Then
            clsReturn.Add clsNewChild
        End If
    Next clsChild

    Set FilterByData2 = clsReturn

End Property
Public Property Get FilterByData2(ByVal lData As Long) As CGrains

    Dim clsGrain As CGrain
    Dim clsReturn As CGrains

    Set clsReturn = New CGrains

    For Each clsGrain In Me
        If clsGrain.Data2 = lData Then
            clsReturn.Add clsGrain
        End If
    Next clsGrain

    Set FilterByData2 = clsReturn

End Property
Public Property Get FilterByData3(ByVal dtData As Date, ByVal sComp As String) As CParents

    Dim clsParent As CParent
    Dim clsNewParent As CParent
    Dim clsChild As CChild
    Dim clsReturn As CParents

    Set clsReturn = New CParents

    For Each clsParent In Me
        Set clsNewParent = New CParent
        clsNewParent.Name_ = clsParent.Name_
        Set clsNewParent.Children = clsParent.Children.FilterByData3(dtData, sComp)
        If clsNewParent.Children.Count > 0 Then
            clsReturn.Add clsNewParent
        End If
    Next clsParent

    Set FilterByData3 = clsReturn

End Property
Public Property Get FilterByData3(ByVal dtData As Date, ByVal sComp As String) As CChildren

    Dim clsChild As CChild
    Dim clsNewChild As CChild
    Dim clsGrain As CGrain
    Dim clsReturn As CChildren

    Set clsReturn = New CChildren

    For Each clsChild In Me
        Set clsNewChild = New CChild
        clsNewChild.Name_ = clsChild.Name_
        Set clsNewChild.Grains = clsChild.Grains.FilterByData3(dtData, sComp)
        If clsNewChild.Grains.Count > 0 Then
            clsReturn.Add clsNewChild
        End If
    Next clsChild

    Set FilterByData3 = clsReturn

End Property
Public Property Get FilterByData3(ByVal dtData As Date, ByVal sComp As String) As CGrains

    Dim clsGrain As CGrain
    Dim clsReturn As CGrains
    Dim bAdd As Boolean

    Set clsReturn = New CGrains

    For Each clsGrain In Me
        Select Case sComp
            Case ">="
                bAdd = clsGrain.Data3 >= dtData
            Case ">"
                bAdd = clsGrain.Data3 > dtData
            Case "<"
                bAdd = clsGrain.Data3 < dtData
            Case "<="
                bAdd = clsGrain.Data3 <= dtData
            Case Else
                bAdd = clsGrain.Data3 = dtData
        End Select

        If bAdd Then
            clsReturn.Add clsGrain
        End If
    Next clsGrain

    Set FilterByData3 = clsReturn

End Property
Public Property Get SummarizeGrainValues() As Variant

    Dim clsParent As CParent
    Dim aReturn() As Variant
    Dim lCnt As Long

    ReDim aReturn(1 To Me.Count, 1 To 2)

    For Each clsParent In Me
        lCnt = lCnt + 1
        aReturn(lCnt, 1) = clsParent.Name_
        aReturn(lCnt, 2) = clsParent.SumData1
    Next clsParent

    SummarizeGrainValues = aReturn

End Property
Public Property Get SumData1() As Long

    Dim lReturn As Long
    Dim clsChild As CChild
    Dim clsGrain As CGrain

    For Each clsChild In Me.Children
        For Each clsGrain In clsChild.Grains
            lReturn = lReturn + clsGrain.Data1
        Next clsGrain
    Next clsChild

    SumData1 = lReturn

End Property
A   0
B   0
C   2
Angular-highcharts colors. Is there any way to get color besides Highcharts.getOptions().colors[index]?

Angular-highcharts colors. Is there any way to get color besides Highcharts.getOptions().colors[index]?


By : user1763048
Date : March 29 2020, 07:55 AM
hop of those help? First of all, you need to set the colors of specific chart directly in the chart configuration object, instead in chart.colors, because most probably this setup won't work automatically.
Regarding your question about getting the colors of specific chart (not global Highcharts object), you should be able to access options.colors on Chart object, for example that:
code :
chart: {
  events: {
    load() {
      console.log(this.options.colors)  
    }
  }
}
Highcharts: how to change text and background colors

Highcharts: how to change text and background colors


By : Alexander Popov
Date : March 29 2020, 07:55 AM
seems to work fine You can't write background-color: #000000 but 'background-color': '#000000' or backgroundColor: '#000000' will works
code :
chart: {
  type: 'bar',
  backgroundColor: '#000000',
  style: {
    fontFamily: 'monospace',
    color: "#f00" // This line won't work. You must set color for each element like title, axis labels ...
  }
}
Related Posts Related Posts :
  • Build Fails: `npm rebuild node-sass --force`
  • Angular Datepicker change dateformat
  • Trying to extract data from between two sets of characters
  • Configuring Jest in WebStorm
  • Uncaught Error: Syntax error, unrecognized expression: tr.ec_portfolio_title,
  • JQuery fading in fading out continuously
  • Unexpected end of input (Line 1) and Undefined Function?
  • How to animate the width of a div slowly with jquery
  • JavaScript + RegEx Complications- Searching Strings Not Containing SubString
  • SignalR - Unable to get property 'client' of undefined or null reference
  • full calendar not displaying when loaded (with backbone)
  • Angular: Update service and share data between controllers
  • ReplaceAll Google script
  • Search for matching LI items in separate UL
  • Access arguments of an... argument
  • Customizing Google custom search jsapi (query strings)
  • React | Can´t load Images > Module not found
  • Dynamically creating buttons in DOJO
  • 404 Not Found in AJAX post call
  • How do I find out, using javascript, what software opened and running my application?
  • Javascript to check the status of wireless connection
  • StarDict support for JavaScript and a Firefox OS App
  • Phonegap event Resume
  • call javascript function on ENTER key press?
  • When is the best time to remove no-js classes from the html tag
  • Recommended email sending languages
  • setInterval not working properly with chrome
  • Does IE create new scope for each script tag?
  • Uncaught SyntaxError: Unexpected token < Underscore and parse issues
  • How to pass captured URL to Email Body in HTML
  • How to structure default nested resources?
  • Store all the keys of a JSON object in a variable
  • Need an efficient way to group the Array of object in javascript
  • a sensible approach to highcharts x-axis labels
  • IDE autocompletion for javascript AMD loading style
  • Bootstrap menu disappears after first click setting the ul style to none
  • split ajax json response errors in each field
  • how to add javascript in head in cmsms
  • REGEX: Finding the correct occurrence order of some given special characters in a string
  • How do you preserve a JavaScript date's time zone from browser to server, and back?
  • Return binary result from phantomjs webserver
  • must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.
  • Replacing a substring of an element's text with another string
  • How do I filter marks greater than or equal to 90 in this array?
  • Modify the text of my radio input button?
  • Clicking on status bar does not scroll to top of app (Trigger.io)
  • Mocha JS: How to highlight specific assertion failure?
  • $.getJSON jquery parsing to HTML
  • Find items of a certain class (a) that are also in other classes (b,c,d)
  • Setting different images for D3 force-directed layout nodes
  • Integrating Dropzone.js with angular
  • Control sprite animation speed
  • Can only one error / success function be assigned for AngularJS $http promises?
  • Working with math in javascript
  • Django variable isnt recognized by javascript
  • $.when does not work with $.scrollTo plugin
  • How to read local xml file using $.ajax?
  • Manifest is not Valid JSON. What is wrong?
  • AngularJS re-initialise JS after statechange
  • WebRupee is not working
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org