Trying to show a label instead of data for some special cases in Active Reports' ChartControl

自作多情 提交于 2019-12-24 11:44:57

问题


I have an Active Reports' Chart Control with a very simple graph as follows:

The graph is taking a Data Source to show the values. So far so good.

The problem is that for some cases I need to show instead of one of the values, for instance, in the above example "3.20" another label like, for instance, two asterisks * * due to some business rules. So I need instead of "3.20" to show * * only in that special case.

So my first question is:

  1. Is it possible to modify the data label only for one element of the graph to show another text instead the data value? (so in the above example will show * * instead of 3.20)

I think the answer is negative, (if it is possible that would save my day!) and that leads to the solution I am trying, for instance in the next example below, I want to show * * instead of 82.80 (only for the value 82.80):

So I created an Active Reports' label and I am trying to put it exactly over the data label of the graph object. But a new problem arises: I do not know the exact position (x,y) of the label I want to hide, 82.80, so I can put exactly over it the * * label to hide the value and show my asterisks. So the question is:

  1. If question (1) is not possible, then how can I do to show exactly over the tag of the value a label or box with my alternative tag? Is it possible to know the position using some data provided by the Chart Control object? Thank you!

回答1:


here is a sample of solution for your main question:

        private void detail_Format(object sender, EventArgs e)
    {
        foreach (DataPoint p in MyChart.Series[0].Points)
        {
            if (p.YValues[0] == 3.20)
            {
                p.Marker = new Marker();
                p.Marker.Label = new LabelInfo() { Format = "**" };
            }
        }
    }


来源:https://stackoverflow.com/questions/44753862/trying-to-show-a-label-instead-of-data-for-some-special-cases-in-active-reports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!