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.
Unfortunately, activation email could not send to your email. Please try again.

Mixed Chart

Thread ID:

Created:

Updated:

Platform:

Replies:

118472 Mar 11,2015 05:41 AM Mar 26,2015 08:06 AM WinRT 12
loading
Tags: Chart
Ibrahim Islam
Asked On March 11, 2015 05:41 AM

SyncFusion's forums have been helpful in the past and also I have been experimenting with WinRT controls. Before I dig deeper I wanted to know whether using SyncFusion's WinRT controls I can produce a chart like following:

sample
Few things to note which are out of the ordinary:
  • Line charts start from Y-Axis
  • Top column chart has its own axis
  • Column chart is aligned to bottom line chart's data points except the first one
Any suggestion to this will be helpful adopt us Syncfusion's Charting controls.

Sheik Syed Abthaheer M [Syncfusion]
Replied On March 12, 2015 06:35 AM

Hi Ibrahim,

Thanks for contacting Syncfusion support.

We have analyzed your query and you can achieve your requirement by using ChartRowDefinition. We have prepared the sample based on your requirement. Please find the sample in the below location.

Sample: Chart_WinRT.zip

Note: We are unable to get your attached image/sample. So, the provided sample if it’s not your requirement, please reattach the sample with more information.

Please let us know if you have any queries.

Regards,
M. Sheik



Ibrahim Islam
Replied On March 13, 2015 11:23 AM

Thanks for the reply Mr. Syed.

I am quite impressed how easy it was with SyncFusion controls and it took me days with WinRTXAMLToolkit.
But I would like to point some inconsistencies that I found in the output.
Please refer to the image below:
sample

As you can notice from the image above:
  • Column chart's axes should not be shown
  • Columns should be aligned to line chart data points
  • Column chart should not contain background grids
These things are very specifically requested by my client and I could change all that with WinRTXAMLToolkit overriding its Style resources. 
But there are performance and flexibility issue due to which I want to change.
Hopefully, there will be some APIs exposed from SyncFusion control's to change it according to my requirement.
Thanks in advance.

Sheik Syed Abthaheer M [Syncfusion]
Replied On March 16, 2015 06:49 AM

Thanks for the reply Mr. Syed.

I am quite impressed how easy it was with SyncFusion controls and it took me days with WinRTXAMLToolkit.
But I would like to point some inconsistencies that I found in the output.
Please refer to the image below:
sample

As you can notice from the image above:
  • Column chart's axes should not be shown
  • Columns should be aligned to line chart data points
  • Column chart should not contain background grids
These things are very specifically requested by my client and I could change all that with WinRTXAMLToolkit overriding its Style resources. 
But there are performance and flexibility issue due to which I want to change.
Hopefully, there will be some APIs exposed from SyncFusion control's to change it according to my requirement.
Thanks in advance.

Hi Ibrahim,

 

Thanks for the update.

 

Query

Response

Column chart's axes should not be shown

In order to hide the axes in chart we need to collapse primary and secondary axis visibility as shown in the below code snippet.

 

Code Snippet[Xaml]:

<chart:NumericalAxis Visibility="Collapsed" Interval="1"/>

Columns should be aligned to line chart data points

We are able to align the top column chart to line chart data point by setting  PrimaryAxis’s RangePadding as “None” as shown in the below code snippet.

 

Code Snippet[Xaml]:

<chart:NumericalAxis RangePadding="None"  chart:ChartBase.Row="1" />

Column chart should not contain background grids

We are able to hide the chart background grids by setting primary and secondary axis property of  ShowGridLines as False as shown in the below code snippet.

 

Code Snippet[Xaml]:

<chart:NumericalAxis ShowGridLines="False"    chart:ChartBase.Row="1" />

 

We have prepared the sample based on your requirement. Please find the sample in the below location.

 

 

Also please find the below UG documentation of SfChart for more information.

 

Link: http://help.syncfusion.com/UG/winrt/documents/features2.htm

 

Please let us know if you have any queries.

 

Regards,

M.Sheik


Sheik Syed Abthaheer M [Syncfusion]
Replied On March 16, 2015 06:52 AM

Hi Ibrahim,

Please find the sample in the below location.


Regards,
M. Sheik


Ibrahim Islam
Replied On March 18, 2015 03:44 AM

Hi Ibrahim,

Please find the sample in the below location.


Regards,
M. Sheik


Mr. Sheik,

Thank you very much.
This worked as expected.
I need to make further modifications.
Like decreasing widths of each column and make them respond to click.
You have already helped so much, I cannot ask anymore.
I will follow the documentation and try my best.

Thanks


Suresh S [Syncfusion]
Replied On March 19, 2015 09:16 AM

Hi Ibrahim,

 

Thanks for your response.

 

Query 1: decreasing widths of each column

 

We can adjust the width of segments by using SegmentSpacing property as shown in the below code snippet

Code Snippet[Xaml]:

<chart:ColumnSeries SegmentSpacing="0.5" />

 

Query 2: make them respond to click.

 

We can achieve interactivity with  column segments by using ChartSelectionBehavior. For more information regarding ChartSelectionBehavior, please refer our help documentation link

 

Ug link: http://help.syncfusion.com/UG/winrt/default.htm#!documents/selection1.htm

 

Sample: Chart_WinRT.zip

 

Note: SegmentSpacing value should be fall between 0 and 1

 

Please let us know if you require further assistance with this.

 

Regards,

Suresh S


Ibrahim Islam
Replied On March 19, 2015 11:39 AM

Thank your for the help Mr. Suresh S.
I was able to decrease their width.
But you will notice in my opening post that the column chart/series had its own X-Axis as Category Axis.
I need to be able to do the same in SfChart as shown below:
problem

This is the XAML:
        <Grid.DataContext>
            <local:ViewModel />
        </Grid.DataContext>
        <chart:SfChart AreaBorderThickness="0" 
                       Width="1366" 
                       x:Name="Chart"
                       HorizontalAlignment="Left">
            <chart:SfChart.RowDefinitions>
                <chart:ChartRowDefinition />
                <chart:ChartRowDefinition />
            </chart:SfChart.RowDefinitions>
            <chart:SfChart.PrimaryAxis>
                <chart:NumericalAxis  Interval="1"
                                      Header="LineSeries Axis"/>
            </chart:SfChart.PrimaryAxis>
            <chart:SfChart.SecondaryAxis>
                <chart:NumericalAxis EdgeLabelsDrawingMode="Shift" />
            </chart:SfChart.SecondaryAxis>
            <chart:LineSeries XBindingPath="X" 
                              YBindingPath="Y" 
                              ItemsSource="{Binding DataModel}">
                <chart:LineSeries.AdornmentsInfo>
                    <chart:ChartAdornmentInfo ShowLabel="False" 
                                              Symbol="Ellipse" 
                                              ShowMarker="True">
                    </chart:ChartAdornmentInfo>
                </chart:LineSeries.AdornmentsInfo>
            </chart:LineSeries>
            <chart:ColumnSeries  XBindingPath="X" 
                                 YBindingPath="Z"
                                 SegmentSpacing="0.8"
                                 ItemsSource="{Binding DataModel}">
                <chart:ColumnSeries.XAxis>
                    <chart:NumericalAxis RangePadding="None" 
                                         Visibility="Collapsed" 
                                         ShowGridLines="False" 
                                         Interval="1" 
                                         OpposedPosition="True"   
                                         chart:ChartBase.Row="1" />
                </chart:ColumnSeries.XAxis>
                <chart:ColumnSeries.YAxis>
                    <chart:NumericalAxis  
                        EdgeLabelsDrawingMode="Shift"  
                        Visibility="Collapsed" 
                        ShowGridLines="False"  
                        chart:ChartBase.Row="1" />
                </chart:ColumnSeries.YAxis>
            </chart:ColumnSeries>
        </chart:SfChart>

Is it possible inside the ColumnSeries or do I have to have another separate Column Chart for this? 
Please let me know.

Suresh S [Syncfusion]
Replied On March 20, 2015 06:55 AM

Hi Ibrahim,

 

Thanks for your response.

 

By default in ChartRowDefinition the axis is placed in Row 0 and if you want to show axis for Row 1 then we can use OpposedPosition as true for Row1 primary axis  to display in top. But we are unable to place the axis in bottom for Row 1.

 

However you can achieve your requirement by using two chart in grid row definition as shown in the below code snippet.

 

Code Snippet [Xaml]:

<chart:SfChart Grid.Row=”0”>

<!—Series 1-->

<chart:SfChart/>    

<chart:SfChart Grid.Row=”1”/>

<!—Series 2-->

<chart:SfChart/>    

 

We have prepared a sample demonstrating this, please download it from below location.

 

Sample: Chart_WinRT.zip

 

Please let us know if you require further assistance on this.

Regards,

Suresh S


Ibrahim Islam
Replied On March 23, 2015 11:59 AM

Hi Ibrahim,

 

Thanks for your response.

 

By default in ChartRowDefinition the axis is placed in Row 0 and if you want to show axis for Row 1 then we can use OpposedPosition as true for Row1 primary axis  to display in top. But we are unable to place the axis in bottom for Row 1.

 

However you can achieve your requirement by using two chart in grid row definition as shown in the below code snippet.

 

Code Snippet [Xaml]:

<chart:SfChart Grid.Row=”0”>

<!—Series 1-->

<chart:SfChart/>    

<chart:SfChart Grid.Row=”1”/>

<!—Series 2-->

<chart:SfChart/>    

 

We have prepared a sample demonstrating this, please download it from below location.

 

Sample: Chart_WinRT.zip

 

Please let us know if you require further assistance on this.

Regards,

Suresh S


Mr. Suresh S,

Thank you for your reply.
I went through your project and it is fine.
Except when I change the column chart's X-Axis to CategoryAxis the alignment with Line chart goes away.
I cannot have it as NumericAxis because as you can see in the screenshot it needs to be a formatted date string.
So what can I do to have a CategoryAxis and also have data points aligned to line chart data points please?


Above result is from modified code of yours:

<Grid x:Name="Grid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

        <Grid.DataContext>

            <local:ViewModel />

        </Grid.DataContext>

        <Grid.RowDefinitions>

            <RowDefinition/>

            <RowDefinition/>

        </Grid.RowDefinitions>


        <chart:SfChart Grid.Row="0" 

                       Margin="10,0,0,0" 

                       AreaBorderThickness="0" 

                       Width="1366">

            <chart:ColumnSeries Interior="SaddleBrown"  

                                XBindingPath="X" 

                                YBindingPath="Z"

                                SegmentSpacing="0.8"

                                ItemsSource="{Binding DataModel}">

                <chart:ColumnSeries.XAxis>

                    <chart:CategoryAxis  ShowGridLines="False" 

                                         Interval="1" />

                </chart:ColumnSeries.XAxis>

                <chart:ColumnSeries.YAxis>

                    <chart:NumericalAxis  Visibility="Collapsed"

                                          EdgeLabelsDrawingMode="Shift" 

                                          ShowGridLines="False"  

                                          chart:ChartBase.Row="1" />

                </chart:ColumnSeries.YAxis>

            </chart:ColumnSeries>

        </chart:SfChart>

        

        <chart:SfChart Grid.Row="1" 

                       AreaBorderThickness="0" 

                       Width="1366" 

                       x:Name="Chart">

            <chart:SfChart.PrimaryAxis>

                <chart:NumericalAxis  Interval="1"

                                      Header="LineSeries Axis"/>

            </chart:SfChart.PrimaryAxis>

            <chart:SfChart.SecondaryAxis>

                <chart:NumericalAxis EdgeLabelsDrawingMode="Shift" />

            </chart:SfChart.SecondaryAxis>

            <chart:LineSeries XBindingPath="X" 

                              YBindingPath="Y" 

                              ItemsSource="{Binding DataModel}">

                <chart:LineSeries.AdornmentsInfo>

                    <chart:ChartAdornmentInfo ShowLabel="False" 

                                              Symbol="Ellipse" 

                                              ShowMarker="True">

                    </chart:ChartAdornmentInfo>

                </chart:LineSeries.AdornmentsInfo>

            </chart:LineSeries>            

        </chart:SfChart>

    </Grid>


Suresh S [Syncfusion]
Replied On March 24, 2015 09:15 AM

Hi Ibrahim,

 

Thanks for your response.

 

We have analyzed your requirement and it can be achieved by using axis PlotOffset to position and align line series points to that of column series as shown in below code snippet.

 

Code Snippet [Xaml]:

<chart:SfChart.PrimaryAxis>

           <chart:NumericalAxis PlotOffset="133"/>

</chart:SfChart.PrimaryAxis>

 

Also, we have modified the sample based on it, please download from below location.

 

Sample: Chart_WinRT.zip

 

Please let us know if you require further assistance.

 

Regards,

Suresh S


Ibrahim Islam
Replied On March 25, 2015 11:43 AM

Hi Ibrahim,

 

Thanks for your response.

 

We have analyzed your requirement and it can be achieved by using axis PlotOffset to position and align line series points to that of column series as shown in below code snippet.

 

Code Snippet [Xaml]:

<chart:SfChart.PrimaryAxis>

           <chart:NumericalAxis PlotOffset="133"/>

</chart:SfChart.PrimaryAxis>

 

Also, we have modified the sample based on it, please download from below location.

 

Sample: Chart_WinRT.zip

 

Please let us know if you require further assistance.

 

Regards,

Suresh S


Thanks Mr. Suresh S,

I got it working but I am in another issue now.
So, for changing each column color I used CustomTemplate
But when using CustomTemplate SegmentSpacing property is not being respected.
I guess that is to be expected so I used Converter on Width property inside my custom template to reduce the width of each column which works.
But in that case, the column is not aligned to center to the tick mark as shown below:


Any suggestion to as how to solve this?

Suresh S [Syncfusion]
Replied On March 26, 2015 08:06 AM

Hi Ibrahim,

 

Thanks for your response.

 

We have analyzed your requirement and  in order to apply different color for each segment then you can use Palette for ChartSeries. You can apply a set of predefined brushes to the segments by using Palette as “Metro” and if you need to set custom colors to segment then you can use Palette as “Custom” with custom brushes as shown in the below code snippet.

Code Snippet [Xaml]:

<chart:ColumnSeries Palette="Custom">

   <chart:ColumnSeries.ColorModel >

                <chart:ChartColorModel>

                    <chart:ChartColorModel.CustomBrushes>

                       <!--Initialize custombrushes here-->

                   </chart:ChartColorModel.CustomBrushes>

                </chart:ChartColorModel>

  </chart:ColumnSeries.ColorModel>

 

Also, we have modified the sample based on requirement please download it from below location.

 

Sample: Chart_WinRT.zip

 

Note: In custom template with segment spacing we can calculate the proper column position to arrange the column in center or use the predefined width for reduce the column width.

 

Please let us know if you require further assistance

 

Regards,

Suresh S


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;