不同颜色的图表
Different color chart
我有2种图表,饼图和柱状图。
我展示了两个图表的相同数据,问题是两个图表中显示每个设备的颜色不一样。
谢谢
The chart legend uses color fields to match the legend items to the
visible data points. The legend can only show one color field per
legend item (data series); hence, it shows the color of the first data
point within that series. Remember this when you use expressions to
dynamically determine the color of individual data points within a
series; the legend item always shows the actual color of the first
data point.
在两个图表中使用相同的图例顺序应该可以解决问题。
Series are ordered in the legend according to the order that they are
processed by the Reporting Services processing engine. You can change
the order by changing the order of fields in the data fields
drop-zone. If you are using series grouping, the series data is not
known until processing, so that there is no way for you to re-order
these items.
如果您使用的是连续剧(您可能就是这样),在将它们发送给记者之前,您应该确保它们的顺序正确。
另一个解决方案是为您的图表创建自定义图例。这给了你更多的控制权,特别是如果你还定义了一个自定义调色板。
You can get more flexibility and control over the legend by generating
your own custom legend by using a table or a matrix. The easiest way
to synchronize the colors in the chart with your custom legend is to
define your own custom chart color palette.
To build a custom legend
- Add a table data region to the report.
Place the table next to the chart and bind it to the same dataset as the chart.
Mirror the chart grouping structure in the table by adding table
groups.
If the chart uses series groupings, add them to the table by
adding table groups that are based on the same group expression as
the one in the chart series groupings. Then add chart category
groupings (if present) as inner table groups.
In general, if the
chart has m series grouping and n category grouping, you add m+n
table groups for your custom legend.
For the individual table
groups, make sure to show only the group header (which will contain
the legend description). Also, remove the table detail row unless
you want to use the table detail rows to simulate a chart data
table.
Design the custom legend.
Add a rectangle for the color field of the
custom legend. For example, you might add it to the first table
column. As indicated in step 2, you should only have group header
rows in the table. The rectangle goes into the innermost group
header level.
Set the rectangle BackgroundColor property to the equivalent expression used on the chart data point's fill color. In the most
trivial case, the expression would just contain one grouping value as
in the following code.
=Code.GetColor(Fields!Country.Value)
For the legend text, use either the same expression as in the category and series group/label expressions, or experiment until you
achieve the legend description text that you want.
来源:
我有2种图表,饼图和柱状图。
我展示了两个图表的相同数据,问题是两个图表中显示每个设备的颜色不一样。
谢谢
The chart legend uses color fields to match the legend items to the visible data points. The legend can only show one color field per legend item (data series); hence, it shows the color of the first data point within that series. Remember this when you use expressions to dynamically determine the color of individual data points within a series; the legend item always shows the actual color of the first data point.
在两个图表中使用相同的图例顺序应该可以解决问题。
Series are ordered in the legend according to the order that they are processed by the Reporting Services processing engine. You can change the order by changing the order of fields in the data fields drop-zone. If you are using series grouping, the series data is not known until processing, so that there is no way for you to re-order these items.
如果您使用的是连续剧(您可能就是这样),在将它们发送给记者之前,您应该确保它们的顺序正确。
另一个解决方案是为您的图表创建自定义图例。这给了你更多的控制权,特别是如果你还定义了一个自定义调色板。
You can get more flexibility and control over the legend by generating your own custom legend by using a table or a matrix. The easiest way to synchronize the colors in the chart with your custom legend is to define your own custom chart color palette.
To build a custom legend
- Add a table data region to the report.
Place the table next to the chart and bind it to the same dataset as the chart.Mirror the chart grouping structure in the table by adding table groups.
If the chart uses series groupings, add them to the table by adding table groups that are based on the same group expression as the one in the chart series groupings. Then add chart category groupings (if present) as inner table groups.In general, if the chart has m series grouping and n category grouping, you add m+n table groups for your custom legend.
For the individual table groups, make sure to show only the group header (which will contain the legend description). Also, remove the table detail row unless you want to use the table detail rows to simulate a chart data table.
Design the custom legend.
Add a rectangle for the color field of the custom legend. For example, you might add it to the first table column. As indicated in step 2, you should only have group header rows in the table. The rectangle goes into the innermost group header level.Set the rectangle BackgroundColor property to the equivalent expression used on the chart data point's fill color. In the most trivial case, the expression would just contain one grouping value as in the following code.
=Code.GetColor(Fields!Country.Value)
For the legend text, use either the same expression as in the category and series group/label expressions, or experiment until you achieve the legend description text that you want.
来源: