This is a migrated thread and some comments may be shown as answers.

Remove background item from 3d chart

3 Answers 59 Views
Chart
This is a migrated thread and some comments may be shown as answers.
victor
Top achievements
Rank 1
victor asked on 21 Apr 2016, 05:00 PM

Hi Telerik Team

I´m working with 3d chart, but some of my requeriments is to hide or remove the backgroud of the 3d chart, please check the attached image to understand what I need. 

Thanks in advance

3 Answers, 1 is accepted

Sort by
0
Petar Marchev
Telerik team
answered on 25 Apr 2016, 08:21 AM
Hello,

One way to go is to hide the PlaneXY when the chart loads:
private void chart1_Loaded(object sender, RoutedEventArgs e)
{
  PlaneXY planeXY = Telerik.Windows.Controls.ChildrenOfTypeExtensions.ChildrenOfType<PlaneXY>((RadChart)sender).First();
  planeXY.Visibility = Visibility.Collapsed;
}

Regards,
Petar Marchev
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
victor
Top achievements
Rank 1
answered on 25 Apr 2016, 05:19 PM

Hello, thanks for your reply.

Unfortunately your code is giving me a crash, I guess is because planeXY is null and I don't know why.
My telerik version is 2016.1.112.1050, Below I have posted my xaml, so could you please check it.

Thanks in advance

 

<UserControl x:Class="_3dchart.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadChart x:Name="chart1"  Grid.Column="0" Grid.Row="1" Margin="10 0 20 0" Loaded="chart1_Loaded"   Background="Transparent"  ItemsSource="{Binding Hazards}">
            <telerik:RadChart.DefaultView>
                <telerik:ChartDefaultView  >
                    <telerik:ChartDefaultView.ChartArea>
                        <telerik:ChartArea >
                            <telerik:ChartArea.Extensions>
                                <telerik:CameraExtension  x:Name="Camara" />
                            </telerik:ChartArea.Extensions>
                            <telerik:ChartArea.AxisX>
                                <telerik:AxisX TicksDistance="0"   LabelRotationAngle="90" >
                                </telerik:AxisX>
                            </telerik:ChartArea.AxisX>

                            <telerik:ChartArea.AxisY>
                                <telerik:AxisY  DefaultLabelFormat="P0">
                                </telerik:AxisY>

                            </telerik:ChartArea.AxisY>
                            <telerik:ChartArea.Legend>
                                <telerik:ChartLegend Visibility="Collapsed" />
                            </telerik:ChartArea.Legend>
                        </telerik:ChartArea>
                    </telerik:ChartDefaultView.ChartArea>
                </telerik:ChartDefaultView>


            </telerik:RadChart.DefaultView>

            <telerik:RadChart.SeriesMappings>
                <telerik:SeriesMapping ChartAreaName="chartArea">
                    <telerik:SeriesMapping.SeriesDefinition>
                        <telerik:Bar3DSeriesDefinition ItemLabelFormat="#VAL{P2}"  LegendDisplayMode="DataPointLabel"  />
                    </telerik:SeriesMapping.SeriesDefinition>


                    <telerik:SeriesMapping.ItemMappings>
                        <telerik:ItemMapping FieldName="PoF" DataPointMember="YValue" />
                        <telerik:ItemMapping FieldName="HazardName" DataPointMember="XCategory" />
                    </telerik:SeriesMapping.ItemMappings>
                </telerik:SeriesMapping>
            </telerik:RadChart.SeriesMappings>
        </telerik:RadChart>

    </Grid>
</UserControl>

0
Petar Marchev
Telerik team
answered on 27 Apr 2016, 07:18 AM
Hello,

What do you mean that the code is giving you a crash? Is it indeed a null reference exception? Perhaps in this case you can do the same in a LayoutUpdated.

private void chart1_Loaded(object sender, RoutedEventArgs e)
{
 this.chart1.LayoutUpdated += this.chart1_LayoutUpdated;
}
 
private void chart1_LayoutUpdated(object sender, System.EventArgs e)
{
 PlaneXY planeXY = Telerik.Windows.Controls.ChildrenOfTypeExtensions.ChildrenOfType<PlaneXY>(this.chart1).FirstOrDefault();
 if (planeXY != null)
 {
  planeXY.Visibility = Visibility.Collapsed;
  this.chart1.LayoutUpdated -= this.chart1_LayoutUpdated;
 }
}


Regards,
Petar Marchev
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Chart
Asked by
victor
Top achievements
Rank 1
Answers by
Petar Marchev
Telerik team
victor
Top achievements
Rank 1
Share this question
or