Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cant change the color fill for radial bars #35

Closed
chokies opened this issue Dec 18, 2018 · 2 comments
Closed

cant change the color fill for radial bars #35

chokies opened this issue Dec 18, 2018 · 2 comments

Comments

@chokies
Copy link

chokies commented Dec 18, 2018

below is my current implementation. im trying to make the colors dynamic but it seems like its always stuck on the default blue color

`<script>

export default {

props: ['id','chartClass', 'fillColor', 'label'], 

data() {
    return {
        series: [55],
        chartOptions: {
            plotOptions: {
                radialBar: {
                    startAngle: 0,
                    endAngle: 360,
                    hollow: {
                        margin: 0,
                        size: '50%',
                        dropShadow: {
                            enabled: false,
                            top: 3,
                            left: 0,
                            blur: 4,
                            opacity: 0.24
                        },
                    },
                    
                    track: {
                        background: '#DDD',
                        strokeWidth: '100%',
                        margin: 0 // margin is in pixels
                    },

                    dataLabels: {
                        showOn: 'always',
                        name: {
                            offsetY: 20,
                            show: true,
                            color: '#333',
                            fontSize: '14px'
                        },
                        value: {
                            formatter: function(val) {
                                return parseInt(val);
                            },
                            color: '#DDD',
                            fontSize: '30px',
                            show: true,
                            offsetY: -15,
                        }
                    }
                },
                
                fill: {
                    type: 'solid',
                    colors: ['#F44336', '#E91E63', '#9C27B0']
                },
                color: [this.fillColor],
                stroke: {
                    dashArray: 4
                },
            },
            labels: [this.label],
        }
    }
},

mounted () {
    
    
    
}

}
</script>`

@junedchhipa
Copy link
Contributor

You have fill and stroke at the wrong places. It needs to be 1 step outside the plotOptions

data() {
  return {
    series: [55],
    chartOptions: {
      plotOptions: {
        radialBar: {
          startAngle: 0,
          endAngle: 360,
          hollow: {
            margin: 0,
            size: '50%',
            dropShadow: {
              enabled: false,
              top: 3,
              left: 0,
              blur: 4,
              opacity: 0.24
            },
          },

          track: {
            background: '#DDD',
            strokeWidth: '100%',
            margin: 0 // margin is in pixels
          },

          dataLabels: {
            showOn: 'always',
            name: {
              offsetY: 20,
              show: true,
              color: '#333',
              fontSize: '14px'
            },
            value: {
              formatter: function (val) {
                return parseInt(val);
              },
              color: '#DDD',
              fontSize: '30px',
              show: true,
              offsetY: -15,
            }
          }
        },              
      },
      fill: {
        type: 'solid',
        colors: ['#F44336', '#E91E63', '#9C27B0']
      },
      stroke: {
        dashArray: 4
      },
    }
  }
},

Or, you can also directly target the outermost colors property in chartOptions

data() {
  return {
    series: [55],
    chartOptions: {
       colors: ['#3ec23e']
     }
  }
},

@chokies
Copy link
Author

chokies commented Dec 18, 2018

You have fill and stroke at the wrong places. It needs to be 1 step outside the plotOptions

data() {
  return {
    series: [55],
    chartOptions: {
      plotOptions: {
        radialBar: {
          startAngle: 0,
          endAngle: 360,
          hollow: {
            margin: 0,
            size: '50%',
            dropShadow: {
              enabled: false,
              top: 3,
              left: 0,
              blur: 4,
              opacity: 0.24
            },
          },

          track: {
            background: '#DDD',
            strokeWidth: '100%',
            margin: 0 // margin is in pixels
          },

          dataLabels: {
            showOn: 'always',
            name: {
              offsetY: 20,
              show: true,
              color: '#333',
              fontSize: '14px'
            },
            value: {
              formatter: function (val) {
                return parseInt(val);
              },
              color: '#DDD',
              fontSize: '30px',
              show: true,
              offsetY: -15,
            }
          }
        },              
      },
      fill: {
        type: 'solid',
        colors: ['#F44336', '#E91E63', '#9C27B0']
      },
      stroke: {
        dashArray: 4
      },
    }
  }
},

Or, you can also directly target the outermost colors property in chartOptions

data() {
  return {
    series: [55],
    chartOptions: {
       colors: ['#3ec23e']
     }
  }
},

thanks it worked!

@chokies chokies closed this as completed Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants