I've been playing with this for the better part of two days and I'm stumped. I have a StackAreaChart where I'm passing a datatable into the chart. The datatable is set up with the following columns:
When I simply set the datasource of this chart to the datatable and swap the columns and rows, I get the StackAreaChart I expect to get. For each department, the y-axis reflects the data in each department's column and the x-axis reflects the StartTime. When hovering over the datapoints I get the location of that point on the chart. The legend contains an entry for each department and follows the colormodel that was set up in the designer just as the chart does. The <ITEM_LABEL> is the department name.
Now, I need to add a line and some special formatting to just 1 of my Areas which means I need to change this from a StackAreaChart to a Composite chart with a StackArea Layer. How would I go about setting the datasource for the StackArea Layer? What type of series should I use? How should I set the value columns?
Thank you
Hello Bryan,
There are different approaches to solve this task, depending of your scenario. To be able to help you, I need to have more details or if it is possible to take a look at your project or smilar sample. Could you please upload small sample with your scenarion and issue, and I`ll be glad to research is for you.
Let me know if you have any questions.
Regards
Sorry, I marked your response as the answer, but discovered my work around from a month ago was actually still fixing the problem. I believe you are correct that a compositelegend is a better option for a compositechart, but in your example, it is very difficult to tell if your solution fixed the issue at all. I applied it to my application anyway and thought it was working, until I remembered that work around. After removing it, the problem presented itself once more. I feel modifying opacity level of the legend items through the ChartDrawItem event is not the best solution, especially when you consider that on noncomposite chart, this is unnecessary. In case there is no better solution available, I've posted my code below for others to use
If e IsNot Nothing And e.Primitive.Path IsNot Nothing AndAlso e.Primitive.Path = "Legend" Then e.Primitive.PE.FillOpacity = 150 End If
Here is the sample :
If you are using composite chart, my suggestion is to use also composite legend. For example:
CompositeLegend myLegend = new CompositeLegend();
myLegend.ChartLayers.Add(myScatterLayer);
myLegend.Bounds =new Rectangle(88, 2, 11, 15);
myLegend.BoundsMeasureType =MeasureType.Percentage;
myLegend.PE.ElementType =PaintElementType.Gradient;
myLegend.PE.FillGradientStyle =GradientStyle.ForwardDiagonal;
myLegend.PE.Fill =Color.CornflowerBlue;
myLegend.PE.FillStopColor =Color.Transparent;
myLegend.Border.CornerRadius = 10;
myLegend.Border.Thickness = 1;
this.ultraChart1.CompositeChart.Legends.Add(myLegend);
Please take a look at the attached sample with compiste scatterChart and composite legend and let me know if you have any questions.
I managed to get this working with the following code.
Dim series As New NumericSeries For i As Integer = 3 To dt.Columns.Count - 1 series = New NumericSeries series.DataBind(dt, dt.Columns(i).ColumnName, "INT_START_TIME") series.Label = dt.Columns(i).ColumnName ugcResults.CompositeChart.ChartLayers(0).Series.Add(series) Next
Now however I'm experiencing a problem with the Legend. The colormodel I'm useing has an AlphaLevel of 150 and this is reflected in the chart as it should. The legend however displays the colors as if the AlphaLevel was 255. Any ideas?