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

Can categories be displayed via dataLabels? #150

Closed
diomed opened this issue Oct 9, 2018 · 5 comments
Closed

Can categories be displayed via dataLabels? #150

diomed opened this issue Oct 9, 2018 · 5 comments

Comments

@diomed
Copy link

diomed commented Oct 9, 2018

I see that series can, but how would I display categories in bar as well?

@junedchhipa
Copy link
Contributor

@diomed I failed to understand what you mean. Can you please elaborate?
Are you looking for something like this?
screen shot 2018-10-09 at 7 27 21 pm

@diomed
Copy link
Author

diomed commented Oct 9, 2018

yes

@junedchhipa
Copy link
Contributor

I will put the above example in website demo pages soon.

For now, you can try the following code to achieve the same result

{ 
  plotOptions: {
    bar: {
      horizontal: true,
      dataLabels: {
          position: 'bottom'
      },
    }
  },
  dataLabels: {
    enabled: true,
    textAnchor: 'start',
    style: {
        colors: ['#fff']
    },
    formatter: function(val, opt) {
        return opt.globals.labels[opt.dataPointIndex] + ":  " + val
    },
    offsetX: 0,
  },
  yaxis: {
    labels: {
      show: false
    }
  }
}

@junedchhipa
Copy link
Contributor

Added example on website https://apexcharts.com/javascript-chart-demos/bar-charts/custom-datalabels/

@diomed
Copy link
Author

diomed commented Oct 9, 2018

thank you for your help 👍

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