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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding SfChart to a LinearLayout has size problems

Thread ID:

Created:

Updated:

Platform:

Replies:

120533 Sep 24,2015 05:21 AM UTC Sep 24,2015 09:39 AM UTC Xamarin.Android 1
loading
Tags: SfChart
Manuel Cecconi
Asked On September 24, 2015 05:21 AM UTC

Hi,
  I am using the SfChart control but I have problem adding it to a LinearLayout: the size of the SfChart seem wrong.
  Here my code:

      m_oChart = new SfChart (oView.Context);

      //Initializing Primary Axis
      CategoryAxis primaryAxis = new CategoryAxis ();
      primaryAxis.Title.Text = "Month";

      m_oChart.PrimaryAxis = primaryAxis;

      //Initializing Secondary Axis
      NumericalAxis secondaryAxis = new NumericalAxis ();
      secondaryAxis.Title.Text = "Temperature";

      m_oChart.SecondaryAxis = secondaryAxis;

      m_oLinearLayoutChart.AddView(m_oChart);

  Seem I am missing something to say chart should "match_parent" control. Of course I don't want the chart to take all the size of my fragment.

  Thanks in advance,
  Manuel



Magesh Kumar Krishnan [Syncfusion]
Replied On September 24, 2015 09:39 AM UTC

Hi Manuel,

Thanks for using Syncfusion products.

We can achieve your requirement by setting layout parameters for chart with weight using the below code example.
Code Example:

[C#]


chart.LayoutParameters = new TableLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, 1f);


Note: We have used table layout parameters for chart, since weight property is available only in TableLayout. Please refer the link below.

Link: http://forums.xamarin.com/discussion/3290/how-do-i-change-the-property-layout-weight-by-code  

Thanks,
Magesh Kumar K

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.

Warning Icon 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.Close Icon

;