Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
livecharts
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
潘栩锋
livecharts
Commits
176bb4df
Commit
176bb4df
authored
Aug 03, 2019
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
ed182e01
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
34 deletions
+83
-34
ChartPoint.cs
Core40/ChartPoint.cs
+7
-1
Extentions.cs
Core40/Helpers/Extentions.cs
+6
-3
ColumnRangeAlgorithm.cs
Feng/Core40/SeriesAlgorithms/ColumnRangeAlgorithm.cs
+1
-1
ColumnRangeSeries.cs
Feng/WpfView/ColumnRangeSeries.cs
+32
-0
ColumnRangeExample.xaml
WpfApp1/ColumnRangeExample.xaml
+1
-0
ColumnRangeExample.xaml.cs
WpfApp1/ColumnRangeExample.xaml.cs
+36
-29
No files found.
Core40/ChartPoint.cs
View file @
176bb4df
...
...
@@ -24,13 +24,14 @@ using LiveCharts.Definitions.Charts;
using
LiveCharts.Definitions.Points
;
using
LiveCharts.Definitions.Series
;
using
LiveCharts.Dtos
;
using
System
;
namespace
LiveCharts
{
/// <summary>
/// Defines a point in the chart
/// </summary>
public
class
ChartPoint
public
class
ChartPoint
:
IDisposable
{
#
region
Cartesian
//#modify by feng
...
...
@@ -225,5 +226,10 @@ namespace LiveCharts
public
IChartView
ChartView
{
get
{
return
SeriesView
.
Model
.
Chart
.
View
;
}
}
internal
double
Gci
{
get
;
set
;
}
public
void
Dispose
()
{
View
=
null
;
}
}
}
\ No newline at end of file
Core40/Helpers/Extentions.cs
View file @
176bb4df
...
...
@@ -38,7 +38,8 @@ namespace LiveCharts.Helpers
/// <typeparam name="T">type to iterate with</typeparam>
/// <param name="source">collection to iterate</param>
/// <param name="predicate">action to execute</param>
internal
static
void
ForEach
<
T
>(
this
IEnumerable
<
T
>
source
,
Action
<
T
>
predicate
)
//internal static void ForEach<T>(this IEnumerable<T> source, Action<T> predicate)
public
static
void
ForEach
<
T
>(
this
IEnumerable
<
T
>
source
,
Action
<
T
>
predicate
)
{
foreach
(
var
item
in
source
)
predicate
(
item
);
}
...
...
@@ -48,7 +49,8 @@ namespace LiveCharts.Helpers
/// </summary>
/// <param name="toSplit">collection to split</param>
/// <returns>collection of collections</returns>
internal
static
IEnumerable
<
IList
<
ChartPoint
>>
SplitEachNaN
(
this
IList
<
ChartPoint
>
toSplit
)
//internal static IEnumerable<IList<ChartPoint>> SplitEachNaN(this IList<ChartPoint> toSplit)
public
static
IEnumerable
<
IList
<
ChartPoint
>>
SplitEachNaN
(
this
IList
<
ChartPoint
>
toSplit
)
{
var
l
=
new
List
<
ChartPoint
>(
toSplit
.
Count
);
var
acum
=
-
1
;
...
...
@@ -75,7 +77,8 @@ namespace LiveCharts.Helpers
/// </summary>
/// <param name="axis">current orientation</param>
/// <returns>inverted axis orientation</returns>
internal
static
AxisOrientation
Invert
(
this
AxisOrientation
axis
)
//internal static AxisOrientation Invert(this AxisOrientation axis)
public
static
AxisOrientation
Invert
(
this
AxisOrientation
axis
)
{
return
axis
==
AxisOrientation
.
X
?
AxisOrientation
.
Y
...
...
Feng/Core40/SeriesAlgorithms/ColumnRangeAlgorithm.cs
View file @
176bb4df
Feng/WpfView/ColumnRangeSeries.cs
View file @
176bb4df
...
...
@@ -20,18 +20,38 @@
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
//using System;
//using System.Windows;
//using System.Windows.Controls;
//using System.Windows.Media;
//using System.Windows.Shapes;
//using LiveCharts.Definitions.Points;
//using LiveCharts.Definitions.Series;
//using LiveCharts.Dtos;
//using LiveCharts.SeriesAlgorithms;
//using LiveCharts.Wpf.Charts.Base;
//using LiveCharts.Wpf.Points;
//using LiveCharts.Helpers;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Media
;
using
System.Windows.Media.Animation
;
using
System.Windows.Shapes
;
using
LiveCharts.Definitions.Points
;
using
LiveCharts.Definitions.Series
;
using
LiveCharts.Dtos
;
using
LiveCharts.Helpers
;
using
LiveCharts.SeriesAlgorithms
;
using
LiveCharts.Wpf.Charts.Base
;
using
LiveCharts.Wpf.Components
;
using
LiveCharts.Wpf.Points
;
namespace
LiveCharts.Wpf
{
/// <summary>
...
...
@@ -181,6 +201,18 @@ namespace LiveCharts.Wpf
return
pbv
;
}
///// <summary>
///// Erases series
///// </summary>
//public override void Erase(bool removeFromView = true)
//{
// ActualValues.GetPoints(this).ForEach(p =>
// {
// if (p.View != null)
// p.View.RemoveFromView(Model.Chart);
// });
// if (removeFromView) Model.Chart.View.RemoveFromView(this);
//}
#
endregion
#
region
Private
Methods
...
...
WpfApp1/ColumnRangeExample.xaml
View file @
176bb4df
...
...
@@ -32,6 +32,7 @@
<TextBlock Text="{Binding IsRunning,Mode=OneWay}"/>
</StackPanel>
<Button Content="Update" Width="80" Padding="5" Click="Button_Click"/>
<Button Content="GC" Width="80" Padding="5" Click="ButtonGC_Click"/>
</StackPanel>
</Grid>
</Window>
\ No newline at end of file
WpfApp1/ColumnRangeExample.xaml.cs
View file @
176bb4df
...
...
@@ -41,6 +41,11 @@ namespace WpfApp1
else
viewModel
.
Start
();
}
private
void
ButtonGC_Click
(
object
sender
,
RoutedEventArgs
e
)
{
GC
.
Collect
();
}
}
public
class
ColumnRangeExampleViewModel
:
INotifyPropertyChanged
{
...
...
@@ -97,11 +102,22 @@ namespace WpfApp1
v
=
double
.
NaN
;
boltValues
.
Add
(
new
BoltValue
(
bolt
.
Begin
,
bolt
.
End
,
v
));
}
// if (SeriesCollection.Count() > 0)
// SeriesCollection.Clear();
BoltValues
.
Clear
();
Values
.
Clear
();
BoltValues
.
AddRange
(
boltValues
);
Values
.
AddRange
(
datas2
);
}
public
void
Init
()
{
...
...
@@ -133,33 +149,24 @@ namespace WpfApp1
}
boltmap
[
2
].
End
=
(
boltmap
[
3
].
End
+
boltmap
[
3
].
Begin
)
/
2
;
SeriesCollection
=
new
SeriesCollection
{
new
LineSeries
{
Title
=
"Line"
,
Values
=
Values
,
StrokeThickness
=
2
,
Stroke
=
new
SolidColorBrush
(
System
.
Windows
.
Media
.
Colors
.
Blue
),
Fill
=
new
SolidColorBrush
(
System
.
Windows
.
Media
.
Colors
.
Transparent
),
PointGeometry
=
null
,
},
new
ColumnRangeSeries
{
Title
=
"ColumnRange"
,
Values
=
BoltValues
,
StrokeThickness
=
2
,
Stroke
=
new
SolidColorBrush
(
System
.
Windows
.
Media
.
Colors
.
DarkRed
),
Fill
=
new
SolidColorBrush
(
System
.
Windows
.
Media
.
Color
.
FromArgb
(
0x80
,
0xff
,
0
,
0
)),
DataLabels
=
true
,
YAxisCrossing
=
150
,
Configuration
=
Mappers
.
Weighted
<
BoltValue
>()
.
X
(
b
=>(
b
.
From
+
b
.
To
)/
2
)
.
Weight
(
b
=>
Math
.
Abs
(
b
.
From
-
b
.
To
))
.
Y
(
b
=>
b
.
Value
)
}
};
SeriesCollection
=
new
SeriesCollection
();
SeriesCollection
.
Add
(
new
ColumnRangeSeries
{
Title
=
"ColumnRange"
,
Values
=
BoltValues
,
StrokeThickness
=
2
,
Stroke
=
new
SolidColorBrush
(
System
.
Windows
.
Media
.
Colors
.
DarkRed
),
Fill
=
new
SolidColorBrush
(
System
.
Windows
.
Media
.
Color
.
FromArgb
(
0x80
,
0xff
,
0
,
0
)),
DataLabels
=
true
,
YAxisCrossing
=
150
,
Configuration
=
Mappers
.
Weighted
<
BoltValue
>()
.
X
(
b
=>
(
b
.
From
+
b
.
To
)
/
2
)
.
Weight
(
b
=>
Math
.
Abs
(
b
.
From
-
b
.
To
))
.
Y
(
b
=>
b
.
Value
)
});
Formatter
=
value
=>
value
.
ToString
(
"N"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment