Jump to content
Software FX Community

Pane's alingment when there more then one axis on pane.


AlexeyRedko

Recommended Posts

Hello .

I created a chart  and load dynamcally the data (two panes and three series).After loading data I get a misalignment of two panes.I attached code for example. (Is this valid state? if it is valid is there any workaround to this issue).

 

XAML:

<

Window x:Class="PaneAligment.MainWindow"

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Title="MainWindow" Height="350" Width="525"

xmlns:cfx="http://schemas.softwarefx.com/chartfx/wpf/80"

xmlns:cfxmotifs="http://schemas.softwarefx.com/chartfx/wpf/80/motifs">

<Grid>

<Grid.RowDefinitions>

<RowDefinition></RowDefinition>

<RowDefinition Height="30"></RowDefinition>

</Grid.RowDefinitions><cfx:Chart Name="chart" Palette="{x:Static cfx:Palettes.Basic}"

Style="{x:Static cfxmotifs:Simple.Style}"UseEffects="False" BorderThickness="1"

PointCount="0" />

<Button Grid.Row="1" Click="Button_Click">Load Data</Button></Grid>

</

Window>

 

Code behinde:

public partial class MainWindow : Window

{

public MainWindow()

{

InitializeComponent();

Clear();

chart.AxisX = new Axis();

}

private void Clear()

{

chart.Data.Series = 0;

chart.Series.Clear();

chart.Panes.Clear();

}

private void Button_Click(object sender, RoutedEventArgs e)

{

Clear();

ReloadData();

}

private void ReloadData()

{

 

double[] data1 = new double[10] { 1, 2, 3, 6, 5, 4, 9, 8, 7, 10 };

double[] data2 = new double[10] { 1, 2, 3, 6, 5, 4, 9, 8, 7, 10 };double[] data3 = new double[10] { 10, 20, 30, 60, 50, 40, 90, 80, 70, 10 };SeriesAttributes sa1 = new SeriesAttributes();

sa1.ItemsSource = data1;

chart.Series.Add(sa1);

Pane pane = new Pane();Axis ax1 = new Axis();

ax1.Min = 0;

ax1.Max = 10;

this.chart.Panes.Add(pane);

pane.Series.Add(sa1);

sa1.AxisY = ax1;

sa1.AxisX = chart.AxisX;

pane.AxesY.Add(ax1);

 

SeriesAttributes sa2 = new SeriesAttributes();

sa2.ItemsSource = data2;

chart.Series.Add(sa2);

Pane pane2 = new Pane();Axis ax2 = new Axis();

ax2.Min = 1;

ax2.Max = 10;

this.chart.Panes.Add(pane2);

pane2.Series.Add(sa2);

sa2.AxisY = ax2;

sa2.AxisX = chart.AxisX;

pane2.AxesY.Add(ax2);

SeriesAttributes sa3 = new SeriesAttributes();

sa3.ItemsSource = data3;

chart.Series.Add(sa3);

Axis ax3 = new Axis();

ax3.Min = 10;

ax3.Max = 100;

pane2.Series.Add(sa3);

sa3.AxisY = ax3;

sa3.AxisX = chart.AxisX;

pane2.AxesY.Add(ax3);

chart.PanesPanel = new StackPanePanel();

}

}

 

 

 

Link to comment
Share on other sites

We have code that tries to align panes but only when there is one one axis on the "aligned" side of each pane. If this works for your particular scenario moving one of the axes to the right in the second pane should fix the misalignment.

ax2.Position = AxisPosition.Far;

JuanC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...