简体   繁体   English

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

[英]Default 3D chart transparency with ASP.NET Chart Control?

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: 如何强制它们像这张图片一样透明: 替代文字

taken from 3D Area chart example shipped with ASP.NET Chart controls . 取自ASP.NET Chart控件附带的3D Area chart示例。 This chart has ChartColorPalette.BrightPastel pallete, but is transparent. 此图表具有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. 我还有ChartColorPalette.BrightPastel调色板的3D图表,但是不透明,我仍然找不到如何让它像示例图表一样透明。 (After examining example markup and codebehind): (在检查示例标记和代码隐藏后):

替代文字

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图表。

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? 我的猜测是,您可以通过迭代明亮的柔和调色板中的颜色并添加Alpha通道来创建新的调色板 - 如果您在全局静态中执行此操作,可能作为webapp init逻辑的一部分,您应该能够引用它很容易 - 如果你不想有任何代码隐藏,你呢?可以吗? be able to databind your custom palette to the CustomPalette property, but I can't say with certainty. 能够将自定义调色板数据绑定到CustomPalette属性,但我不能肯定地说。

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);

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);
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM