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

WPF Chart

How do i limit the maximum number of bar charts X item on a WPF Bar Chart from c#.

Or

I want to horizontal scrolling feature and maintain minimum width of the Bar Graph.

I have a data count more than 50 and i couldn't even see it on the chart.

Any help will be appreciated




6 Replies

AD Administrator Syncfusion Team January 23, 2008 04:51 AM UTC

Hi Bestin Abhraham,

Chart series width will be automatically increased on increasing the size of the chart area.
Adding a scroll viewer to the chart area is not a best use case. However if you need the scroll bar inside the chart area you can call the chart zooming command in the window load event. By doing this it will zoom the chart but the zooming kit will be displayed. A provision to disable the zooming kit is under development and will be available in the next release.

You can use the following code snippet to zoom the chart in the window load event.

ChartAreaCommands.SwitchZooming.Execute(null, Chart1.Areas[0]);
Chart1.Areas[0].PrimaryAxis.ZoomFactor = 0.5;
Chart1.Areas[0].PrimaryAxis.ZoomPosition = 0;
Chart1.Areas[0].SecondaryAxis.ZoomFactor = 0.5;
Chart1.Areas[0].SecondaryAxis.ZoomPosition = 0;

Let me know if you have further queries

Regards,
Athaur Rahman GS




AR Arumugam March 10, 2016 02:51 PM UTC

How can I use Zooming Command for chart using ViewModel? WHat are the Possiblities

<Button Grid.Row="0" Content="Print" 
                    Command="{x:Static syncfusion:ChartAreaCommands.ZoomOut}"
        CommandTarget="{Binding ElementName=Chart1}" x:Name="button"></Button>

If I use Command like above, my button will get disabled automatically.

What could be the problem? Could you clarify me?

Thanks in advance.


AR Arumugam March 10, 2016 02:52 PM UTC

How can I use Zooming Command for chart using ViewModel? WHat are the Possiblities

<Button Grid.Row="0" Content="Print" 
                    Command="{x:Static syncfusion:ChartAreaCommands.ZoomOut}"
        CommandTarget="{Binding ElementName=Chart1}" x:Name="button"></Button>

If I use Command like above, my button will get disabled automatically.

What could be the problem? Could you clarify me?

Thanks in advance.


SJ Sumathi Jayaraj Syncfusion Team March 14, 2016 12:50 PM UTC

Hi Arumugam,

Thanks for contacting Syncfusion Support.

In order to execute the zooming commands through Button control, CommandTarget should hold the type of ChartArea. We have prepared a sample for your requirements and it can be downloaded from the following location.

Sample: WpfProject

Regards,
Sumathi J


AR Arumugam March 16, 2016 08:08 PM UTC

Thanks Sumathi.

The idea which you suggested I have tried in my application, but my button is get disabled when I bind command to it. Find the attachment for your reference.

Following is my requirement.

I want to ZoomIn and ZoomOut on Run Time Plotting.

XAxis -> DateTime
YAxis -> Couple of YAxis and equivalent Y Series.

I have tried in a couple of ways

1. Using ZoomFactor to zoomIn and zoomOut. => This will work in case of Static Data, Mine is runtime plotting data.
2. Command Binding. => Button is getting disabled.

Find the attachment in Drive.


Thanks in advance.


SJ Sumathi Jayaraj Syncfusion Team March 17, 2016 12:31 PM UTC

Hi Arumugam,
 
Thanks for the update.
 
ChartAreaCommands are available only in Chart (classic) not in SfChart. We can zoom in the chart by decreasing the zoom factor in the button click event. We have modified your sample and it can be downloaded from the following sample.
 
Sample: Wpf_Application

Please refer to the below link for more information about zooming in SfChart.
http://help.syncfusion.com/wpf/sfchart/interactive-features#zooming-and-panning 

Regards,
Sumathi J

Loader.
Live Chat Icon For mobile
Up arrow icon