We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Setting SfChart alignment

I've created SfChart within a UserControl element, and I try to align the SfChart so it will be in the middle of the UserControl or even fill all the UserControl.

The SfChart is still aligned to top right corner regardless of any changes I make.

The UserControl will be added into a RibbonWindow.


UserControl xaml:



 
<UserControl x:Class="WX.UserControl1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:WX"
        xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008
        mc:Ignorable="d"  Name="main">
 
    <Grid >
    
        <syncfusion:SfChart x:Name="chart1" HorizontalAlignment="Center" VerticalAlignment="Center" >

            <syncfusion:SfChart.PrimaryAxis>
                <syncfusion:NumericalAxis Name="xAxis" Visibility="Hidden"  />
            </syncfusion:SfChart.PrimaryAxis>

            <syncfusion:SfChart.SecondaryAxis >
                <syncfusion:NumericalAxis Name="yAxis" Visibility="Hidden" />
            </syncfusion:SfChart.SecondaryAxis>

            <syncfusion:FastLineSeries Name="chr" MouseMove="chart1_MouseMove" ItemsSource="{Binding measurments}" Interior="Blue" SortDirection="Ascending" ListenPropertyChange="True" XBindingPath="X" YBindingPath="Y" />
            
        </syncfusion:SfChart>
 
    </Grid>

</UserControl>




RibbonWindow xaml:
 
        <DockPanel Name="dll" Grid.Row="1" Grid.ColumnSpan="3" >
      
        </DockPanel>
     
UserControl will be added into the DockPanel.



How the RibbonWindow looks like: (Aligned to the top right corner)



How can I fixed it so the SfChart would be in the middle of the UserControl (or fill it).

Regards,

Dov.



5 Replies

SJ Sumathi Jayaraj Syncfusion Team March 22, 2016 10:34 AM UTC

Hi Dov,
 
Thanks for contacting Syncfusion Support.
 
We are unable to reproduce the reported problem from our side. Please check with the sample provided in the following location. If the issue still persist, then please provide us the modified sample to validate at our end.
 
We are unable to view the images attached in this thread. So, please share the images along with the sample.
 
Sample: ChartSample 
 
Regards,
Sumathi J


DO Dov March 22, 2016 12:55 PM UTC

Hi,

I added a sample that I've created and a picture to display my problems, BTW the problem occur on the sample code that you sent me.

pic.jpg display 3 problems:

1. UserControl isn't fill the all DockPanel, it's just adjusted to the top right corner leaving blank space to the left and bottom sides (marked in the pic in red).
2. The chart axis seems to get cut in the end (top right corner - marked in the pic in blue).
3. I can't draw the line exactly on X axis (marked in the pic in green).


Thank you for all your help.

Dov.

Attachment: sample_f4d4809e.rar


SJ Sumathi Jayaraj Syncfusion Team March 23, 2016 12:04 PM UTC

Hi Dov,

Thanks for the update.

Query 1: UserControl isn't fill the all DockPanel, it's just adjusted to the top right corner leaving blank space to the left and bottom sides

The space in the left and bottom side are allocated for the X-Axis and Y-Axis. Visibility of both the axes are set to hidden, so that it reserves the spaces occupied by the axes are in the layout. We can set the visibility as collapsed.

Query 2: The chart axis seems to get cut in the end

The problem occurs, due to the range(falls in 0 to 1024) of the x-axis. Actual interval of the x-axis is 50, and the interval between last two ticks are 24. So the axis seems to be cut in the edge.

Query 3: I can't draw the line exactly on X axis

In the sample interval of the y-axis is 1000 and the data of the series is ~8190. So it draws near to the gridline which refers 8000.

Screenshot : sample

Regards,
Sumathi J


DO Dov March 23, 2016 12:51 PM UTC

Thank you very much.

Dov.


RA Rachel A Syncfusion Team March 24, 2016 09:05 AM UTC

Hi Dov,

Thanks for the update.

Please let us know if you need any further assistance .

Regards,
Rachel.A

Loader.
Live Chat Icon For mobile
Up arrow icon