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

Use a DateAxis for the Y-Axis of an XY-Chart #1531

Closed
kobL opened this issue May 21, 2024 · 2 comments
Closed

Use a DateAxis for the Y-Axis of an XY-Chart #1531

kobL opened this issue May 21, 2024 · 2 comments
Labels

Comments

@kobL
Copy link

kobL commented May 21, 2024

Question
Hi!

I tried to switch the DateAxis and CategoryAxis on the "Gantt Chart with Dates" Demo: https://www.amcharts.com/demos/gantt-chart-dates/ as we need it in our application like this.

Unfortunately, the columns are now drawn incorrectly: https://codepen.io/kobL/pen/BaeKYaQ

image

Every column starts at the Y-Axis and is drawn into the middle of the category. For the first category it is almost correct and just shifted to the left. But all other categories overlap with the ones before.

What I tried:

  • reordered data: no effect on columns, only on grid lines which are now incorrect. I assume the data is correctly ordered.
  • switched openValueYField and valueYField, no effect.
  • only used valueYField: no columns are drawn
  • chart layout: no effect on horizontal or vertical

Is it simply not possible in AmCharts5 to use a DateAxis for the y-Axis? Or did I miss some settings? Any help is much appreciated.

Environment (if applicable)

  • amCharts version : 5.9.9
  • Browser and its version: Chrome 124.0.6367.202

Additional context

@martynasma
Copy link
Collaborator

You'll need to set baseAxis on your series:

var series = chart.series.push(am5xy.ColumnSeries.new(root, {
  xAxis: xAxis,
  yAxis: yAxis,
  baseAxis: xAxis,
  openValueYField: "start",
  valueYField:"end",
  categoryXField: "category",
  sequencedInterpolation: true
}));

Docs: https://www.amcharts.com/docs/v5/charts/xy-chart/series/#Base_axis

@kobL
Copy link
Author

kobL commented May 21, 2024

That was it, thank you very much for the help!

@kobL kobL closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants