leqid
leqid

Reputation: 931

Reporting Services chart text is blurry when rendered in ReportViewer control on web page

Issue

We are rendering a bar chart on a web page using a Reporting Services report and the ReportViewer control. Sometimes the text on the chart is sharp:

Chart with text that is sharp

But most of the time, the text on the chart is blurry:

Chart with text that is blurry

What is going on?

Steps Taken to Resolve and Other Information

Affects Browsers

Environment

Upvotes: 10

Views: 6523

Answers (3)

Jitender Singh
Jitender Singh

Reputation: 1

This is not proper solution but could help. The steps are as follows:

  1. Open report rdl in report builder
  2. select the chart's text, that gets blurred
  3. Type 'C' in Font Style (on top menu) and press enter
  4. Font style change but unknown
  5. Try to run and see the difference

Upvotes: -1

Jason Parker
Jason Parker

Reputation: 4994

An easy was to resolve this is by putting a rectangle directly into your tablix cell, and then put the chart inside of that rectangle. (Instead of having the chart directly in the tablix cell.)

Not 100% sure why it works... but it does.

Upvotes: 0

leqid
leqid

Reputation: 931

Cause

The ReportViewer control renders charts as a PNG image. The ReportViewer adds width, height, and min-width properties to the CSS for the image. These CSS properties cause the image to undergo scaling to a slightly smaller size in the browser. The image scaling causes the observed blurriness.

Resolution

The issue is resolved in our environment by using additional CSS to override several CSS properties rendered by the ReportViewer. The Reporting Services chart is given a special tag in BIDS so a CSS selector can find the affected image.

Step 1. Give the chart a unique value for its ToolTip property:

Unique value for ToolTip property in BIDS

(The unique value in this example is MyOfficeChart.)

When the chart is rendered as an <img>, the <img> tag's alt and title attributes are set to this value.

Step 2. Create CSS to select the <img> by the unique value of the title attribute, and override the issue-causing CSS:

img[title$='MyOfficeChart']
{
    height:auto !important;
    width:auto !important;
    min-width:0 !important;
}

These steps resolve the issue for all browsers and users, and whether the chart has a border or not.

Upvotes: 14

Related Questions