ASP.NET Chart Control的默认3D图表透明度?

时间:2022-12-04 10:30:45

like two guys before me there and second one there I have difficulty with 3D chart.

像我之前的两个家伙和第二个那里我有3D图表的困难。

How to force them to be transparent like this picture: alt text http://i37.tinypic.com/20jk0ls.png

如何强制它们像这张图片一样透明:alt text http://i37.tinypic.com/20jk0ls.png

taken from 3D Area chart example shipped with ASP.NET Chart controls. This chart has ChartColorPalette.BrightPastel pallete, but is transparent.

取自ASP.NET Chart控件附带的3D Area chart示例。此图表具有ChartColorPalette.BrightPastel托盘,但是透明。

I have also 3D chart with ChartColorPalette.BrightPastel palette, but is not transparent and I still cannot found way how to make it transparent like example chart. (After examining example markup and codebehind):

我还有ChartColorPalette.BrightPastel调色板的3D图表,但是不透明,我仍然找不到如何让它像示例图表一样透明。 (在检查示例标记和代码隐藏后):

alt text http://i33.tinypic.com/10sbq7p.png

alt text http://i33.tinypic.com/10sbq7p.png

The only way I've found is to set the color of series with alpha channel for transparency, or use color palette with transparent colors (for example ChartColorPalette.SemiTransparent) but there must be some other default way which I'm missing.

我发现的唯一方法是使用alpha通道设置系列的颜色以获得透明度,或者使用透明色的调色板(例如ChartColorPalette.SemiTransparent),但必须有一些我缺少的其他默认方式。

Reason I really need this to know is that I'm creating graphs without any code behind just using markup, so I'm finding it a little bit redundant to create code snippets only because of this.

我真正需要知道的原因是我正在创建没有任何代码的图形,只是因为使用了标记,所以我发现创建代码片段有点多余。

Thank you very much for any answers.

非常感谢你的任何答案。

Edit: I'm using .NET 3.5 version of ASP.NET charts.

编辑:我正在使用.NET 3.5版本的ASP.NET图表。

3 个解决方案

#1


1  

I'd same problem here. Solved using this:

我在这里遇到同样的问题。解决了这个问题:

// After all series manipulation, add this
chart.ApplyPaletteColors();
foreach (var serie in chart.Series)
    serie.Color = Color.FromArgb(220, serie.Color);

#2


1  

I see you're on this thread too. Unfortunately, you do need to use colors with an alpha channel in order to set transparency AFAIK

我看到你也在这个帖子上。不幸的是,您需要使用带alpha通道的颜色来设置透明度AFAIK

Here's a good overview of the palettes available and some basics on manipulating them

这里是可用调色板的一个很好的概述和操作它们的一些基础知识

My guess is that you could create a new palette by iterating over the colors in the bright pastel palette and adding an alpha channel - if you do this in a global static, perhaps as part of your webapp init logic, you should be able to reference it pretty easily - if you don't want to have any codebehind, you ?may? be able to databind your custom palette to the CustomPalette property, but I can't say with certainty.

我的猜测是,您可以通过迭代明亮的柔和调色板中的颜色并添加alpha通道来创建新的调色板 - 如果您在全局静态中执行此操作,可能作为webapp init逻辑的一部分,您应该能够引用它很容易 - 如果你不想有任何代码隐藏,你呢?可以吗?能够将自定义调色板数据绑定到CustomPalette属性,但我不能肯定地说。

#3


1  

If you do use palette, and not one color per series, you have to set color for every point:

如果您使用调色板,而不是每个系列使用一种颜色,则必须为每个点设置颜色:

myChart.ApplyPaletteColors();

foreach (var series in myChart.Series)
{
    foreach (var point in series.Points)
    {
        point.Color = Color.FromArgb(220, point.Color);
    }
}

#1


1  

I'd same problem here. Solved using this:

我在这里遇到同样的问题。解决了这个问题:

// After all series manipulation, add this
chart.ApplyPaletteColors();
foreach (var serie in chart.Series)
    serie.Color = Color.FromArgb(220, serie.Color);

#2


1  

I see you're on this thread too. Unfortunately, you do need to use colors with an alpha channel in order to set transparency AFAIK

我看到你也在这个帖子上。不幸的是,您需要使用带alpha通道的颜色来设置透明度AFAIK

Here's a good overview of the palettes available and some basics on manipulating them

这里是可用调色板的一个很好的概述和操作它们的一些基础知识

My guess is that you could create a new palette by iterating over the colors in the bright pastel palette and adding an alpha channel - if you do this in a global static, perhaps as part of your webapp init logic, you should be able to reference it pretty easily - if you don't want to have any codebehind, you ?may? be able to databind your custom palette to the CustomPalette property, but I can't say with certainty.

我的猜测是,您可以通过迭代明亮的柔和调色板中的颜色并添加alpha通道来创建新的调色板 - 如果您在全局静态中执行此操作,可能作为webapp init逻辑的一部分,您应该能够引用它很容易 - 如果你不想有任何代码隐藏,你呢?可以吗?能够将自定义调色板数据绑定到CustomPalette属性,但我不能肯定地说。

#3


1  

If you do use palette, and not one color per series, you have to set color for every point:

如果您使用调色板,而不是每个系列使用一种颜色,则必须为每个点设置颜色:

myChart.ApplyPaletteColors();

foreach (var series in myChart.Series)
{
    foreach (var point in series.Points)
    {
        point.Color = Color.FromArgb(220, point.Color);
    }
}