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

ScalesXAt, ScalesYAt should reference directly to XAxis,Yaxis instead of index #1504

Closed
Daimonion1980 opened this issue May 2, 2024 · 2 comments
Labels
question Further information is requested

Comments

@Daimonion1980
Copy link

Daimonion1980 commented May 2, 2024

Hello
I'm using LiveCharts to display often two oder more data stream of consecutive values (from a serial interface). Every data stream has its own YAxis and the connection to the data stream is done vie the ScaleYAt Property.
https://livecharts.dev/api/2.0.0-rc2/LiveChartsCore.SkiaSharpView.LineSeries-2#property-ScalesYAt

Adding a data stream:

YAxis.Add(new Axis
{ 
   .. data from the Axis
});
ISeries elmnt = new LineSeries<DateTimePointScopeDatasetAdapter>
{
  ...other properties
  ScalesYAt = YAxis.Count() - 1
};
elmnt.SeriesId = generatedUniqueId;
PlotData.Add(elmnt);

When removing one data stream from the diagram (not the last) I also do remove the associated YAxis from the List.

Removing a data stream:

var existingPlot = PlotData.FirstOrDefault(i => i.SeriesId == parameter.Id);
if (existingPlot is not null)
{
    //Read index for the connected  YAxis
    int? yAxisPosition = (existingPlot as LineSeries<DateTimePointScopeDatasetAdapter>)!.ScalesYAt;
    if (yAxisPosition.HasValue)
    {
        YAxis.RemoveAt(yAxisPosition.Value);
    }
    PlotData.Remove(existingPlot);
}

But after doing this I have to reorder all the other ScalesYAt Values from the remaining data streams, because this property is an index to the list.

Describe the solution you'd like
Is it possible to reference the Yaxis directly? e.g.

  ScalesYAt = YAxis[index]
@Daimonion1980 Daimonion1980 changed the title ScalesXAt, ScalesYAt should reference directly to XAxis,Yaxis ScalesXAt, ScalesYAt should reference directly to XAxis,Yaxis instead of index May 2, 2024
@beto-rodriguez beto-rodriguez added the question Further information is requested label Sep 13, 2024
@beto-rodriguez
Copy link
Owner

Hello

Sadly no, axes are designed to work by index, sadly you would need to handle that manually :(

I will close this for now, but let me know if there is something I can do to help.

@Daimonion1980
Copy link
Author

Hey,

Is it possible to save this as a feature request?

From the perspective of 2.0.0, I can understand, that this will not be changed in this release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants