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

Axis Labels don't show on save method

5 Answers 53 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Abraham
Top achievements
Rank 1
Abraham asked on 06 May 2011, 06:59 PM
I am trying to save a radchart to a MemoryStream and then save it within a generated pdf. The chart is successfully saved as an image in the pdf, however the axis labels do not show. Is there a property I need to set for the axis labels that I am not aware of? Thank you

-Abraham

5 Answers, 1 is accepted

Sort by
0
Abraham
Top achievements
Rank 1
answered on 09 May 2011, 06:57 PM
It also does not work as just a regular save file. Please see attached code:

<telerik:RadChart ID="radChart1" runat="server" Height="876px" Width="876px" AutoLayout="true"
                                    AutoTextWrap="true" Skin="Hay" Visible="false">
                                    <ClientSettings ScrollMode="Both" />
                                    <ChartTitle TextBlock-Text="Test" TextBlock-Appearance-TextProperties-Color="Black">
                                    </ChartTitle>
                                    <Legend Appearance-Position-AlignedPosition="Center" Appearance-Overflow="Row" Visible="true">
                                        <Appearance Position-Auto="true" ItemAppearance-Visible="true">
                                        </Appearance>
                                    </Legend>
                                    <PlotArea>
                                        <XAxis AxisLabel-TextBlock-Text="Date and Time" AxisLabel-Visible="true">
                                            <AxisLabel Visible="true" TextBlock-Visible="true">
                                            </AxisLabel>
                                        </XAxis>
                                        <YAxis AxisLabel-TextBlock-Text="Units" AxisLabel-Visible="true">
                                            <AxisLabel Visible="true" TextBlock-Visible="true">
                                            </AxisLabel>
                                        </YAxis>
                                        <Appearance>
                                        </Appearance>
                                    </PlotArea>
                                    <Series>
                                    </Series>
                                </telerik:RadChart>


And for the code behind I'm just doing a simple save

radChart1.Save("C:\\projects\\test.png", System.Drawing.Imaging.ImageFormat.Png);

As I said before, the chart and legend is saving to the image but the axis labels are not. Thank you
0
Abraham
Top achievements
Rank 1
answered on 10 May 2011, 06:56 PM
I have found the issue and have come up with a solution. Having ScrollMode in the client setting section of my chart set to "Both" was causing the image produced by the save method to return an image without the x and y axis nor axis labels. In my code behind, setting ScrollMode to "None" before saving saving the chart as an image, and then resetting the ScrollMode to "Both" solved this issue. Maybe this is something telerik can look at as a bug fix in the future. Thank you
0
Evgenia
Telerik team
answered on 11 May 2011, 12:48 PM
Hi Abraham,

Thanks for sharing your resolution of the issue with us. Your feedback was forwarded to our developers.
You may find your Telerik points updated.

All the best,
Evgenia
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Alexander
Top achievements
Rank 1
answered on 12 Feb 2012, 12:11 AM
I've faced the same issue. But I can't use the provided solution, because I have too many labels. When I'm using "None" scroll value,  the labels and the diagram appears too tight at the image. Please let me know if there is any solution of this problem.
0
Evgenia
Telerik team
answered on 15 Feb 2012, 04:24 PM
Hello Alexander,

I am afraid saving/exporting has not been designed to work with zoomed chart, hence the result you observe. I am sorry to say it, there is no applicable workaround at the moment that would allow you to export only the visible part of the graph. You can export the entire chart as you already do with "Save shrink image" button, but set larger dimensions before exporting it. This way labels will look nice and when viewing the image in smaller container the entire image will shrink, so the labels will not overlap:

protected void OnBtn_Click2(object sender, EventArgs e)
        {
            Unit width = RadChart1.Width;
            Unit height = RadChart1.Height;
               
            RadChart1.ClientSettings.ScrollMode = Telerik.Web.UI.ChartClientScrollMode.None;
            RadChart1.Width = Unit.Pixel(1600);
            RadChart1.Height = Unit.Pixel(1200);
            RadChart1.Save("C://ChatrtShrinkImage.png", ImageFormat.Png);
               
            RadChart1.Width = width;
            RadChart1.Height = height;
            RadChart1.ClientSettings.ScrollMode = Telerik.Web.UI.ChartClientScrollMode.Both;
        }

Greetings,
Evgenia
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
Chart (Obsolete)
Asked by
Abraham
Top achievements
Rank 1
Answers by
Abraham
Top achievements
Rank 1
Evgenia
Telerik team
Alexander
Top achievements
Rank 1
Share this question
or