Rotating Charts/Camera Extension

6 posts, 0 answers
  1. Richard Alvarez
    Richard Alvarez avatar
    11 posts
    Member since:
    May 2005

    Posted 18 Apr 2011 Link to this post

    I can't find any documentation on how to set the view angle of a 3d chart to anything but the default.  I saw something that suggested I could use the new camera extension, but I can't find any documentation on it.
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 21 Apr 2011 Link to this post

    Hi Richard Alvarez,
    Please, have a look at our Flexible API demo example - http://demos.telerik.com/silverlight/#Chart/FlexibleAPI, which demonstrates how to enable the CameraExtension when switching to a 3D series.

    You can find another, very simple project that demonstrates the same, attached to the last post in the following forum thread - http://www.telerik.com/community/forums/wpf/chart/adding-camera-extension-gives-error-of-object-reference-not-set-to-an-instance-of-object.aspx.

    You can use the CameraExtension API -- methods like Zoom, RotateX, RotateY, RotateZ, RotateXY etc. to change the default view angle of a 3D chart. For example:
    (this.RadChart1.DefaultView.ChartArea.Extensions[0] as CameraExtension).RotateX(30);

    Kind regards,
    Tsvetie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Richard Alvarez
    Richard Alvarez avatar
    11 posts
    Member since:
    May 2005

    Posted 27 Apr 2011 Link to this post

    The demo link doesn't show me any code-behind.  Just adding the camera extension in the xaml doesn't do anything for me.

    I can't get the other project to run.  The page never loads, just locks up.
  4. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 02 May 2011 Link to this post

    Hi Richard Alvarez,
    In order to see the code of the demo, you just need to click the "Code" tab (in the upper right corner of the demo).

    Regarding the demo project, attached to the other forum thread that I mentioned - I did not have problems running the demo without any modifications. Could you please make sure that you are using the same version (2010.3.1304.35) or later of RadChart for Silverlight?

    In case the problem persists, please open a formal support ticket and send me a running test project that demonstrates your setup. Once I have this project, I will be able to provide you with more concrete information on how to configure your chart control.

    Kind regards,
    Tsvetie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Richard Alvarez
    Richard Alvarez avatar
    11 posts
    Member since:
    May 2005

    Posted 02 May 2011 Link to this post

    I rebooted after installing the Silverlight 5 beta, and the WPF project worked.  I don't know why.

    Anyway, I was able to then rotate the chart in the code-behind before the page was fully rendered.

    However, my real goal was to then render the chart as an image, using ExportToImage.  I moved the rotation into the dispatcher where I run ExportToImage, but the export unfortunately renders the non-rotated version of the chart only.
  6. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 05 May 2011 Link to this post

    Hi Richard Alvarez,
    I updated slightly the demo project to test the ExportToImage method of RadChart and the image I got represented the rotated chart. Have a look at the code I used for my test:
    private void ExportButton_Click(object sender, RoutedEventArgs e)
    {
        (this.RadChart1.DefaultView.ChartArea.Extensions[0] as CameraExtension).RotateX(30);
     
        SaveFileDialog dialog = new SaveFileDialog();
        dialog.DefaultExt = "png";
        dialog.Filter = "*.png | PNG";
        if (!(bool)dialog.ShowDialog())
            return;
     
        Stream fileStream = dialog.OpenFile();
        this.RadChart1.ExportToImage(fileStream);
        fileStream.Close();
    }

    In case this does not help you, please send us a running test project that demonstrates the problem.

    All the best,
    Tsvetie
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top