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

Open
Daimonion1980 opened this issue May 2, 2024 · 0 comments

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
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

1 participant