Issues about SfChart & SfChart3D
Hi Syncfusion,
Attachment: SfChartDemo_d5ac804c.rar
About SfChart I have two questions:
1.How do I display the ChartToolBar control when I use SfChart?
2.When I use the SfChart3D control, the IDE prompts " ' SfChart3D 'does not exist in the namespace' clr-namespace: Syncfusion.UI.Xaml.Charts; assembly = Syncfusion.SfChart.WPF ' ".Which component should be referenced when I use the SfChart3D control?
I wrote a Demo as an attachment.
Thanks,
Mark Li
Attachment: SfChartDemo_d5ac804c.rar
SIGN IN To post a reply.
1 Reply
DA
Devi Aruna Maharasi Murugan
Syncfusion Team
April 10, 2017 09:46 AM UTC
Hi Mark,
Thanks for contacting Syncfusion Support.
Query 1: How do I display the ChartToolBar control when I use SfChart?
Currently, we don’t have ChartToolBar support in SfChart. We have already considered this as feature and have logged feature report for this. The feature can be tracked through our Feature Management System,
This feature will be implemented in any of our upcoming releases.
However, we have achieved this requirement by using the ContextMenu property of the chart and added requirement function as shown in the below code snippet,
|
<chart:SfChart >
<ContextMenu >
<MenuItem Header="Legend">
<MenuItem Header="DockPosition">
<MenuItem Name="top" Header="Top" Click="top_Click"/>
<MenuItem Name="bottom" Header="Bottom" Click="top_Click"/>
<MenuItem Name="left" Header="Left" Click="top_Click"/>
<MenuItem Name="right" Header="Right" Click="top_Click"/>
</MenuItem>
<MenuItem Header="CheckBoxVisibility">
<MenuItem Name="chkBoxVisible" Header="Visible" Click="top_Click"/>
<MenuItem Name="chkBoxCollapse" Header="Collapsed" Click="top_Click"/>
</MenuItem>
</MenuItem>
<MenuItem Header="Palette" Name="palette" >
<MenuItem Header="Metro" Name="metro" Click="top_Click"/>
<MenuItem Header="AutumnBrights" Name="autumn" Click="top_Click"/>
<MenuItem Header="FloraHues" Name="flora" Click="top_Click"/>
<MenuItem Header="PineApple" Name="pine" Click="top_Click"/>
<MenuItem Header="Elite" Name="elite" Click="top_Click"/>
<MenuItem Header="SandyBeach" Name="sandy" Click="top_Click"/>
<MenuItem Header="LightCandy" Name="light" Click="top_Click"/>
</MenuItem>
<MenuItem Header="Print" Name="print" Click="top_Click"/>
<MenuItem Header="Save" Name="Save" Click="top_Click"/>
<MenuItem Header="CrossHairBehavior" Name="enableCrossHair"
Click="top_Click">
</MenuItem>
</ContextMenu>
</chart:SfChart.ContextMenu>
</chart:SfChart>
|
C#
|
private void top_Click(object sender, RoutedEventArgs e)
{
var header = (e.OriginalSource as MenuItem).Header.ToString();
switch(header)
{
case "Top":
(mainChart.Legend as sfchart.ChartLegend).DockPosition = sfchart.ChartDock.Top;
break;
case "Bottom":
(mainChart.Legend as sfchart.ChartLegend).DockPosition = sfchart.ChartDock.Bottom;
break;
case "Left":
(mainChart.Legend as sfchart.ChartLegend).DockPosition = sfchart.ChartDock.Left;
break;
case "Right":
(mainChart.Legend as sfchart.ChartLegend).DockPosition = sfchart.ChartDock.Right;
break;
case "Visible":
(mainChart.Legend as sfchart.ChartLegend).CheckBoxVisibility = Visibility.Visible;
break;
case "Collapsed":
(mainChart.Legend as sfchart.ChartLegend).CheckBoxVisibility = Visibility.Collapsed;
break;
case "Metro":
mainChart.Palette = sfchart.ChartColorPalette.Metro;
break;
case "AutumnBrights":
mainChart.Palette = sfchart.ChartColorPalette.AutumnBrights;
break;
case "FloraHues":
mainChart.Palette = sfchart.ChartColorPalette.FloraHues;
break;
case "PineApple":
mainChart.Palette = sfchart.ChartColorPalette.Pineapple;
break;
case "Elite":
mainChart.Palette = sfchart.ChartColorPalette.Elite;
break;
case "SandyBeach":
mainChart.Palette = sfchart.ChartColorPalette.SandyBeach;
break;
case "LightCandy":
mainChart.Palette = sfchart.ChartColorPalette.LightCandy;
break;
case "Print":
mainChart.Print();
break;
case "Save":
mainChart.Save("chart.png");
break;
case "CrossHairBehavior":
{
mainChart.Behaviors.Add(new sfchart.ChartCrossHairBehavior());
mainChart.PrimaryAxis.ShowTrackBallInfo = true;
mainChart.SecondaryAxis.ShowTrackBallInfo = true;
}
break;
default:
break;
}
} |
Please find the output image,
We have modified the provided sample and it can be downloaded from below link,
Sample: SfChartDemo
Query 2: ' SfChart3D 'does not exist in the namespace
We are unable to reproduce the reported problem with the provided sample.
However, we would like to inform you that, we have added SfChart and classic chart’s namespace in http://schemas.syncfusion.com/wpf schema namespace. So, when we add both chart assemblies in same application, then some chart objects will be conflicted. Because, those objects have same name in both charts (SfChart & Classic chart).
To use both chart in single application, we must use control specific namespace as shown in below.
SfChart:
xmlns:sfchart="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Syncfusion.SfChart.WPF"
Classic Chart:
xmlns:chart="clr-namespace:Syncfusion.Windows.Chart;assembly=Syncfusion.Chart.Wpf"
Regards,
Devi
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
-
ML Mark Li
- Apr 7, 2017 10:12 AM UTC
- Apr 10, 2017 09:46 AM UTC