Was working with some data and I noticed some bug when the YValue of a point is negative while the minimum of an axis is positive.
I made a demo to reproduce the bug
xaml:
ViewModel:
The slider bar changes the Minimum of the AxisY and as soon as the minimum hit 0, you can see that the line are now rendered as if the YValue of the point was 0.
I made a demo to reproduce the bug
xaml:
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
Height
=
"Auto"
/>
</
Grid.RowDefinitions
>
<
telerik:RadChart
ItemsSource
=
"{Binding Points}"
>
<
telerik:RadChart.DefaultView
>
<
telerik:ChartDefaultView
>
<
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartLegend
Visibility
=
"Collapsed"
/>
</
telerik:ChartDefaultView.ChartLegend
>
<
telerik:ChartDefaultView.ChartArea
>
<
telerik:ChartArea
>
<
telerik:ChartArea.AxisX
>
<
telerik:AxisX
MinValue
=
"{Binding MinX}"
MaxValue
=
"{Binding MaxX}"
AutoRange
=
"False"
Step
=
"{Binding StepX}"
/>
</
telerik:ChartArea.AxisX
>
<
telerik:ChartArea.AxisY
>
<
telerik:AxisY
MinValue
=
"{Binding MinY}"
MaxValue
=
"{Binding MaxY}"
AutoRange
=
"False"
Step
=
"{Binding StepY}"
StripLinesVisibility
=
"Collapsed"
/>
</
telerik:ChartArea.AxisY
>
</
telerik:ChartArea
>
</
telerik:ChartDefaultView.ChartArea
>
</
telerik:ChartDefaultView
>
</
telerik:RadChart.DefaultView
>
<
telerik:RadChart.SeriesMappings
>
<
telerik:SeriesMapping
LegendLabel
=
"Line"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:LineSeriesDefinition
ShowItemLabels
=
"False"
>
<
telerik:LineSeriesDefinition.Appearance
>
<
telerik:SeriesAppearanceSettings
>
<
telerik:SeriesAppearanceSettings.PointMark
>
<
telerik:PointMarkAppearanceSettings
Shape
=
"Diamond"
/>
</
telerik:SeriesAppearanceSettings.PointMark
>
</
telerik:SeriesAppearanceSettings
>
</
telerik:LineSeriesDefinition.Appearance
>
</
telerik:LineSeriesDefinition
>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
FieldName
=
"Item1"
DataPointMember
=
"XValue"
/>
<
telerik:ItemMapping
FieldName
=
"Item2"
DataPointMember
=
"YValue"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
<
telerik:SeriesMapping
LegendLabel
=
"Line"
>
<
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:LineSeriesDefinition
ShowItemLabels
=
"False"
>
<
telerik:LineSeriesDefinition.Appearance
>
<
telerik:SeriesAppearanceSettings
>
<
telerik:SeriesAppearanceSettings.PointMark
>
<
telerik:PointMarkAppearanceSettings
Shape
=
"Diamond"
/>
</
telerik:SeriesAppearanceSettings.PointMark
>
</
telerik:SeriesAppearanceSettings
>
</
telerik:LineSeriesDefinition.Appearance
>
</
telerik:LineSeriesDefinition
>
</
telerik:SeriesMapping.SeriesDefinition
>
<
telerik:SeriesMapping.ItemMappings
>
<
telerik:ItemMapping
FieldName
=
"Item1"
DataPointMember
=
"XValue"
/>
<
telerik:ItemMapping
FieldName
=
"Item4"
DataPointMember
=
"YValue"
/>
</
telerik:SeriesMapping.ItemMappings
>
</
telerik:SeriesMapping
>
</
telerik:RadChart.SeriesMappings
>
</
telerik:RadChart
>
<
Slider
Grid.Row
=
"1"
Value
=
"{Binding MinY, Mode=TwoWay}"
Minimum
=
"-10"
Maximum
=
"10"
SmallChange
=
".5"
LargeChange
=
"5"
/>
</
Grid
>
ViewModel:
public
class
ViewModel : INotifyPropertyChanged
{
private
double
_minY = -10;
private
double
_maxY = 50;
private
double
_stepY = 10;
private
double
_minX = 0;
private
double
_maxX = 50;
private
double
_stepX = 10;
public
ViewModel()
{
MaxY = 50;
StepY = 10;
MinX = 0;
MaxX = 50;
StepX = 10;
Points =
new
ObservableCollection<Tuple<
double
,
double
,
double
,
double
>>();
Random r =
new
Random();
Points.Add(Tuple.Create(.1, -8d, 1d, 5d));
for
(
double
i = 20; i < 50; i += 4)
{
Points.Add(Tuple.Create(i, i - 8, (i - 5) + (r.NextDouble() * 9 - 4.5), i - 25));
}
}
public
ObservableCollection<Tuple<
double
,
double
,
double
,
double
>> Points {
get
;
private
set
; }
public
double
MinX {
get
;
private
set
; }
public
double
MaxX {
get
;
private
set
; }
public
double
StepX {
get
;
private
set
; }
public
double
MinY
{
get
{
return
_minY;
}
set
{
_minY = value;
OnPropertyChanged(
"MinY"
);
}
}
public
double
MaxY {
get
;
private
set
; }
public
double
StepY {
get
;
private
set
; }
protected
void
OnPropertyChanged(
string
propertyName)
{
if
(PropertyChanged !=
null
)
{
PropertyChanged.Invoke(
this
,
new
PropertyChangedEventArgs(propertyName));
}
}
public
event
PropertyChangedEventHandler PropertyChanged;
}
The slider bar changes the Minimum of the AxisY and as soon as the minimum hit 0, you can see that the line are now rendered as if the YValue of the point was 0.