Subtitles?

6 posts, 1 answers
  1. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 22 Mar Link to this post

    I looked around through the forums and documentation but could not find anything... is there a way to set a subtitle of the chart, that is one a different line with the main title, that uses a different font and/or color?
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 23 Mar Link to this post

    Hello Steve,

    Thank you for writing.

    You can use the HTML-like Text Formatting to set the chart title. 

    Let me know if you have additional questions.

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 23 Mar Link to this post

    Awkward, but it works, thanks.

    btw, the link is bad.

  5. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 24 Mar Link to this post

    Hi Steve,

    Here is the correct link: HTML-like Text Formatting.

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  6. Steve
    Steve avatar
    43 posts
    Member since:
    May 2014

    Posted 24 Mar Link to this post

    Unfortunately I encountered a problem with this solution. It looks fine on the screen but when I call ExportToImage, it renders the HTML code to the image. The attached file cdf-screenshot is how it looks on the screen and the file cdf-exporttoimage is how it looks after calling ExportToImage
  7. Dimitar
    Admin
    Dimitar avatar
    1415 posts

    Posted 25 Mar Link to this post

    Hello Steve,

    Thank you for writing back.

    This is considered an issue and I have logged it in our Feedback Portal. It is caused because the text is not painted with the correct method. You can track the item for status changes and add your vote for it here.

    To workaround this you can manually paint the text:
    private void radButton1_Click(object sender, EventArgs e)
    {
        radChartView1.ShowTitle = false;
     
        TextPrimitiveHtmlImpl impl = new TextPrimitiveHtmlImpl();
        TextParams textParams = this.radChartView1.ChartElement.TitleElement.TextParams;
        SizeF size = impl.MeasureOverride(new SizeF(500f, 200), textParams);
     
        using (MemoryStream stream = new MemoryStream())
        {
            radChartView1.ExportToImage(stream, new Size(500, 500 - (int)size.Height));
     
            Bitmap bmp = new Bitmap(500, 500);
     
            using (Graphics g = Graphics.FromImage(bmp))
            {
                g.Clear(Color.White);
                textParams.paintingRectangle = new RectangleF(Point.Empty, size);
                impl.PaintPrimitive(new RadGdiGraphics(g), textParams);
                g.DrawImage(Image.FromStream(stream), 0, size.Height, 500, 500 - size.Height);
            }
     
            bmp.Save(@"D:\xfile.bmp");
        }
     
        radChartView1.ShowTitle = true;
    }

    Your Telerik Points have been updated for this report.

    Should you have any other questions do not hesitate to ask.

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top
UI for WinForms is Visual Studio 2017 Ready