Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Im using live charts to show stats from different region of data from my list.
The Regions dont have the same amount of Datapoints and labels will be different for each point.
My code:
public void MakeSeries()
SeriesCollection = new SeriesCollection();
var regionGroupedList = _recordList.Where(x => x.Region != 0 && x.Mmr > 0).GroupBy(g => g.Region);
foreach (var region in regionGroupedList)
var MmrValues = new ChartValues<int>();
List<string> DateLabels = new List<string>();
foreach (var record in region.Where(x => x.Mmr > 0))
MmrValues.Add(record.Mmr);
DateLabels.Add(record.Hero);
SeriesCollection.Add(
new LineSeries{
Title = (region.Key).ToString(),
LineSmoothness = 0, //0: straight lines, 1: really smooth lines
Values = MmrValues,
Labels = DateLabels.ToArray();
DataContext = this;
XAML:
<lvc:CartesianChart Series="{Binding SeriesCollection}" LegendLocation="Right" Margin="0,45,0,0" >
<lvc:CartesianChart.AxisY>
<lvc:Axis Title="MMR"></lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis Title="Game" Labels="{Binding Labels}"></lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
Works if I only use one Region (region1) as soon as I have a second Region (region2) it just shows labels from the region1 ony both lineseries but only as many as region2 has.
What am I doing wrong, is it possible to show each individual labels per lineseries?
I am not an expert so I won't do an example, but maybe I think you should have mutiple axis X, so something like that:
Fill an AxesCollection with Axis Object for each region
For each Axis Object fill the Labels property with what you want.
Bind your axesCollection with AxisX="{Binding AxisXCollection}"
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.