Shared axes with chart area size aligned
See original GitHub issueIs your feature request related to a problem? Please describe. When using Shared Axes, if chart1 Y-axis label is longer than chart2 Y-axis label, then X-axis labels will not align.
Steps to reproduce the behaviour:
- Go to Shared Axes ViewModel.cs
- Change:
for (var i = 0; i < 100; i++)
{
t += r.Next(-90, 100);
values[i] = t;
t2 += r.Next(-90, 100);
values2[i] = t2;
}
- To:
for (var i = 0; i < 100; i++)
{
t += r.Next(10000, 100000);
values[i] = t;
t2 += r.Next(-90, 100);
values2[i] = t2;
}
- Add DrawMarginFrame to help make the problem more visible.
public DrawMarginFrame DrawMarginFrame1 => new DrawMarginFrame
{
Fill = new SolidColorPaint(new SKColor(220, 220, 220)),
Stroke = new SolidColorPaint(new SKColor(180, 180, 180), 2)
};
public DrawMarginFrame DrawMarginFrame2 => new DrawMarginFrame
{
Fill = new SolidColorPaint(new SKColor(220, 220, 220)),
Stroke = new SolidColorPaint(new SKColor(180, 180, 180), 2)
};
- Go to SharedAxes View.xaml and add DrawMarginFrame to both charts:
<lvc:CartesianChart
Grid.Row="0"
Series="{Binding SeriesCollection1}"
XAxes="{Binding SharedXAxis}"
DrawMarginFrame="{Binding DrawMarginFrame1}"
ZoomMode="X">
</lvc:CartesianChart>
<lvc:CartesianChart
Grid.Row="1"
Series="{Binding SeriesCollection2}"
XAxes="{Binding SharedXAxis}"
DrawMarginFrame="{Binding DrawMarginFrame2}"
ZoomMode="X">
- Run sample
Describe the solution you’d like An option should be added to synchronise the chart area width for multiple charts. There may be occasion where the current behaviour is desirable so it should be configurable. The chart with the smallest chart area width would become the reference that the other charts are aligned to.
Current behaviour screenshot is shown below:
Desktop (please complete the following information): OS: Windows 10 PRO Version: Beta 70
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Align x axis of one ChartArea with y axis of another?
I have two ChartArea s, one containing a SeriesChartType.Line and the other containing a SeriesChartType.RangeBar . Separatly the two charts ...
Read more >How to align the size of Plot Areas | VBA & Macros | Excel ...
You can align the plot area manually by placing the chart without axis on top of the chart with (set the fill of...
Read more >Align charts in Excel to have the same axis scale - YouTube
Align charts against gridlines- https://youtu.be/jSbAWDiM0IA 00:00 Link to charts so that they automatically have the same scale 01:02 ...
Read more >Resizing The Plot Area In Excel Chart To Prevent ... - YouTube
Sign up for our Excel webinar, times added weekly: https://www.excelcampus.com/blueprint-registration/ Learn how to resize the plot area so ...
Read more >Add Axes for Multiple Measures in Views
To align the two axes in a dual axes chart to use the same scale, right-click (control-click on Mac) the secondary axis, and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Platonenkov use the
Axis.Padding
property, I know it is a bit complicated now, there will be better solutions in the future.I have right margin
the graph indents are the same, there is no problem with them now.
Indentation size problem for label
solution in 2 stages: