apexcharts.js icon indicating copy to clipboard operation
apexcharts.js copied to clipboard

Horizontal bar axis not showing last (max) label & tick

Open yairEO opened this issue 6 years ago • 12 comments

https://codepen.io/vsync/pen/XvMPGq

When using horizontal bar chart, with data set such as [10,20,100], the xaxis last label (and tick) are missing. Expected to show the value 100 in the right-most side:

image

Options:

{
  chart: {
    height: 380,
    width: "100%",
    type: "bar"
  },
  plotOptions: {
      bar: {
          barHeight: '100%',
          horizontal: true   // ← "true" flip the axis, "100" is not shown anymore
      }
  },
  series: [
    {
      name: "Series 1",
      data: [10,20,100]
    }
  ]
}

When horizontal set to false and the axis flip, the max value is shown as expected & at the current position (although now on the Y axis)

yairEO avatar Jul 30 '19 11:07 yairEO

I'm wonder this as well but using React instead. Hoping for someone to shed some light on this! :)

MerApelsin avatar Aug 08 '19 08:08 MerApelsin

I've noticed that too

tanguyvda avatar Aug 08 '19 16:08 tanguyvda

I have the same problem

ThinkSalat avatar Aug 09 '19 18:08 ThinkSalat

The last x-axis label is intentionally hidden to avoid overflowing in some cases. But, I think, in horizontal bar charts, this should be avoided.

I will change this behavior for horizontal bar charts.

How can I hide the max and show the min label in horizontal bar charts?

algresie avatar Apr 13 '20 13:04 algresie

Is there any way to change this in timeline chart? @junedchhipa

manhbui21 avatar Aug 25 '20 05:08 manhbui21

Will there be a future solution where the final x-axis value is not hidden but also not cut off? (I'm specifically concerned with area charts). @junedchhipa

sophiabarclay avatar Oct 13 '20 15:10 sophiabarclay

What should be done to show last label in Line Chart Dual Axis? @junedchhipa

rutpshah avatar Mar 15 '21 11:03 rutpshah

I see this remains unresolved

NickSutton avatar Jul 31 '22 22:07 NickSutton

The last x-axis label is intentionally hidden to avoid overflowing in some cases. But, I think, in horizontal bar charts, this should be avoided.

I will change this behavior for horizontal bar charts.

-Hi @junedchhipa ,

Is there any configuration available where I can show the last label on x-axis.

Gunjansokal07 avatar Oct 31 '23 17:10 Gunjansokal07

@junedchhipa

5 years gone, but why you can't solve it?

mustakim avatar May 13 '24 04:05 mustakim

I fixed this with th following prop: labels: { rotateAlways: true, }

if you don't want rotate the value from xaxis, set the prop rotate to -1 but you will have to fix the layout

felipevvasconcelos avatar May 21 '24 16:05 felipevvasconcelos

Closing this as this no longer seems to an issue. I tested in v3.51.0 Please provide a new Codepen, and I will re-open this if the issue still persists.

junedchhipa avatar Aug 03 '24 14:08 junedchhipa

in version 4.5.0 is the problem again

Image

spanwair avatar Mar 10 '25 09:03 spanwair

my solution is to turn date labels by 45°:

labels: {
        formatter: (val) => momentTz.tz(new Date(val), currentUser.timeZone).format(props.xLabelFormat)
        rotateAlways: true,
        rotate: -45,
        offsetY: 5,
        offsetX: -5
}

spanwair avatar Mar 11 '25 08:03 spanwair