Openside
-
Posts
2 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by Openside
-
-
Hi
I'm trying to create charts that render either a CurveArea gallery type or Area depending on the users selection. The first thing is that these chart types behave very differently and I have to modify behaviour depending upon which type is selected. If it's an Area I provide values for X, Y and YFrom which then draws the chart correctly. If it's a CurveArea I have to run through the list twice, once for the high value and once for the low value.
For both charts I set the colour opacity to around 60 so that the chart is a little transparent. The issue I have is that for an Area chart I get lines drawn between the Y and YFrom value, I don't want these lines at all as I want a nice clear area drawn. For the CurveArea it doesn't draw the lines as with Area but the first point always draws down to Zero regardless of the set of values.
The sample code below illustrates the problem if anyone has time to try it, just change the Chart Gallery type to Area or CurveArea
chart1.Gallery =
Gallery.Area;List<HighLow> _values = new List<HighLow>(); HighLow _one = new HighLow{
Date = DateTime.Now,High = 10,
Low = 5
};
HighLow _two = new HighLow{
Date = DateTime.Now.AddHours(6),High = 11,
Low = 4
};
HighLow _three = new HighLow{
Date = DateTime.Now.AddHours(12),High = 8,
Low = 2
};
_values.Add(_one);
_values.Add(_two);
_values.Add(_three);
chart1.Data.Series = 1;
chart1.Series[0].Color = Color.FromArgb(50, 255, 20, 30);chart1.Series[0].FillMode =
FillMode.Solid;chart1.AxisX.ForceZero = false;chart1.AxisX.LabelsFormat.Format =
AxisFormat.DateTime;chart1.AxisX.DataFormat.Format = AxisFormat.DateTime;chart1.AxisX.LabelsFormat.CustomFormat =
"dd\nMMM";chart1.AxisX.Min = DateTime.Now.AddDays(-1).ToOADate();chart1.AxisX.Max = DateTime.Now.AddDays(1).ToOADate();chart1.Series[0].SeparateSlice = 1;
if (chart1.Gallery == Gallery.Area){
chart1.DataSourceSettings.Fields.Add(
new FieldMap("Date", FieldUsage.XValue));chart1.DataSourceSettings.Fields.Add(new FieldMap("Low", FieldUsage.FromValue));chart1.DataSourceSettings.Fields.Add(
new FieldMap("High", FieldUsage.Value));ListProvider lstProvider = new ListProvider(_values);chart1.DataSourceSettings.DataSource = lstProvider;
}
else{
foreach (HighLow _highLow in _values){
int _pointId = chart1.Data.Points ++;chart1.Data.X[0, _pointId] = _highLow.Date.ToOADate();
chart1.Data.Y[0, _pointId] = _highLow.Low;
}
_values.Reverse();
foreach (HighLow _highLow in _values){
int _pointId = chart1.Data.Points++;chart1.Data.X[0, _pointId] = _highLow.Date.ToOADate();
chart1.Data.Y[0, _pointId] = _highLow.High;
}
}
The code above uses a class as below
class HighLow{
public int High { get; set; } public int Low { get; set; }public DateTime Date { get; set; }}
Lines on area charts where opacity is applied
in Web Forms
Posted
Hi
I'm creating an area chart that has the colour set with an opacity value. The issue is that ChartFX seems to render this with vertical lines at each X point joining the two Y Values. I'd would like the chart to render as a single colour without the lines does anyone know how to do this. I have attached a sample chart so that you can see the issue. The issue is with the purple area chart rather than the black line.
If anyone has any ideas for resolving this please let me know asap.
Regards
Simon