diff --git a/categories/company-operations/rules-to-better-reporting-services.md b/categories/company-operations/rules-to-better-reporting-services.md index 3b7e813eaa1..178cd556979 100644 --- a/categories/company-operations/rules-to-better-reporting-services.md +++ b/categories/company-operations/rules-to-better-reporting-services.md @@ -26,6 +26,7 @@ index: - least-content-in-page-header - show-past-six-months-in-chart - show-data-and-chart-in-one +- use-expressions-to-scale-charts --- diff --git a/rules/show-data-and-chart-in-one/rule.md b/rules/show-data-and-chart-in-one/rule.md index 0bfffb4f81e..69782f6ff1a 100644 --- a/rules/show-data-and-chart-in-one/rule.md +++ b/rules/show-data-and-chart-in-one/rule.md @@ -1,7 +1,7 @@ --- type: rule archivedreason: -title: Do you show data and chart in one? +title: Data Layout - Do you show data and chart in one? guid: ee74ea88-74e0-4588-9de8-a5162408c0e4 uri: show-data-and-chart-in-one created: 2023-12-11T14:38:33.0000000Z diff --git a/rules/show-past-six-months-in-chart/rule.md b/rules/show-past-six-months-in-chart/rule.md index a720884c640..2157ccdce08 100644 --- a/rules/show-past-six-months-in-chart/rule.md +++ b/rules/show-past-six-months-in-chart/rule.md @@ -1,7 +1,7 @@ --- type: rule archivedreason: -title: Do you show the past 6 months of totals in a chart? +title: Data Layout - Do you show the past 6 months of totals in a chart? guid: fd58a962-6abb-4b89-b147-06d5a9df26fa uri: show-past-six-months-in-chart created: 2023-12-13T10:38:33.0000000Z diff --git a/rules/use-expressions-to-scale-charts/RSRulesChart01.gif b/rules/use-expressions-to-scale-charts/RSRulesChart01.gif new file mode 100644 index 00000000000..54fdd76c4b1 Binary files /dev/null and b/rules/use-expressions-to-scale-charts/RSRulesChart01.gif differ diff --git a/rules/use-expressions-to-scale-charts/RSRulesChart02.gif b/rules/use-expressions-to-scale-charts/RSRulesChart02.gif new file mode 100644 index 00000000000..c8544ccb9ea Binary files /dev/null and b/rules/use-expressions-to-scale-charts/RSRulesChart02.gif differ diff --git a/rules/use-expressions-to-scale-charts/RSRulesChart03.gif b/rules/use-expressions-to-scale-charts/RSRulesChart03.gif new file mode 100644 index 00000000000..19cbbb38645 Binary files /dev/null and b/rules/use-expressions-to-scale-charts/RSRulesChart03.gif differ diff --git a/rules/use-expressions-to-scale-charts/RSRulesChartBad.gif b/rules/use-expressions-to-scale-charts/RSRulesChartBad.gif new file mode 100644 index 00000000000..5d634e624d5 Binary files /dev/null and b/rules/use-expressions-to-scale-charts/RSRulesChartBad.gif differ diff --git a/rules/use-expressions-to-scale-charts/rule.md b/rules/use-expressions-to-scale-charts/rule.md new file mode 100644 index 00000000000..9dd2ee3c490 --- /dev/null +++ b/rules/use-expressions-to-scale-charts/rule.md @@ -0,0 +1,63 @@ +--- +type: rule +archivedreason: +title: Data Layout - Do you use expressions to show the correct scale on charts? +guid: c74b30a3-3593-4b32-a996-6dd96256ab07 +uri: use-expressions-to-scale-charts +created: 2023-12-11T14:38:33.0000000Z +authors: + - title: Jeoffrey Fischer + url: https://ssw.com.au/people/jeoffrey-fischer +related: +- customization-do-you-know-which-version-of-sql-reporting-services-and-visual-studio-you-are-using +redirects: [] + +--- + + + +In Reporting Services 2005 you can use an expression to specify the scale of your charts. If you do not specify a maximum value for your y axis, the bar charts become inaccurate, as you can see in this figure. + +::: bad +![Figure: Bad example - With no scale value set, the charts do not display based on the correct scale](RSRulesChartBad.gif) +::: + +Here's how to set the scale. + +1. In Layout view, add a new row to the bottom of the table + +2. At the bottom of the column with the chart, set the textbox value to =Max(Fields!MyTotal.Value), where "MyTotal" is the Data field you're using in the chart. + +![Figure: Add a new row to your table and set the max value](RSRulesChart01.gif) + +3. Set the textbox's Name property to MaxMyTotal (e.g. MaxCount) + +4. Set the new row's Visibility/Hidden property to true - you don't want to show it in the report + +5. Open the Chart properties and select the "Y Axis" tab + +6. Set the Maximum value to the value of the textbox, i.e. "=ReportItems!MaxMyTotal.Value" + +![Figure: Set the maximum value to the value of the textbox](RSRulesChart02.gif) + +7. If you expect to have negative values in the chart (e.g. when comparing 2 values), set the Minimum to -1 multiplied by the max value, i.e. "=-1 * ReportItems!MaxMyTotal.Value". Otherwise set it to 0 (zero). + +8. If you expect to have negative values in the chart, select the chart value in the Data tab and click "Edit..." . Go to **Appearance->Series Style->Fill** and enter the following expression: + +```sql +=iif(Fields!Change.Value > 0, "Green", "Red") +``` + +Where "Change" is the name of your data field. This sets the color of the bar to green if it is positive, and red if it is negative + +9. Click OK and preview the report. The chart will now be using the maximum value across all the charts. + +::: good +![Figure: Good example - The scale is now correct](RSRulesChart03.gif) +::: + +::: greybox +This way is tedious and a "hack". We think that the scale should be automatically set with an option to customize it via an expression. See our suggestion about this on [Microsoft SQL Reporting Services Suggestions](https://www.ssw.com.au/ssw/Standards/BetterSoftwareSuggestions/ReportingServices.aspx#ChartExpressions). + +Updated - fixed by Microsoft, see +:::