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

Add lines to chart #1604

Closed
OstapchelaEst opened this issue Jul 8, 2024 · 3 comments
Closed

Add lines to chart #1604

OstapchelaEst opened this issue Jul 8, 2024 · 3 comments
Labels

Comments

@OstapchelaEst
Copy link

Hi. I am trying to implement a functionality which is to add a line between two time points. For this I tried to use the trendline approach. But in my case the end point of the line can go beyond the main line and in this case the time range changes and there is an offset. I need a behavior where it will not change and will remain the same as before the line was added. You can see this behavior here by clicking on the "add line" button.

Also in this example I tried to add a line using am5.Line.new but that didn't work either.

Maybe you can give me some advice?

@martynasma
Copy link
Collaborator

You can use series' setting ignoreMinMax: true to make series not influence the actual scale:

  var series = chart.series.push(
    am5xy.LineSeries.new(root, {
      xAxis: xAxis,
      yAxis: yAxis,
      valueXField: "date",
      stroke: color,
      valueYField: "value",
      ignoreMinMax: true
    })
  );

@OstapchelaEst
Copy link
Author

OstapchelaEst commented Jul 10, 2024

@martynasma
Thank you so much it really did work. I modified the code a bit and added "bullets" to the lines that are added. If the lines are close to each other, the bullets overlap each other. I tried to use the stacked property but it doesn't seem to work for "bullets" in different series. Is there any way to shift them relative to each other when they overlap?

Try adding a few lines to see what I'm talking about.
https://jsfiddle.net/bnkz1ao5/34/

@martynasma
Copy link
Collaborator

No, I'm afraid there's no built-in solution for that.

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