mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-27 03:33:25 +08:00
项目结构调整
This commit is contained in:
136
Others/Live-Charts-master/Core/Configurations/CartesianMapper.cs
Normal file
136
Others/Live-Charts-master/Core/Configurations/CartesianMapper.cs
Normal file
@@ -0,0 +1,136 @@
|
||||
//The MIT License(MIT)
|
||||
|
||||
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
|
||||
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
|
||||
//The above copyright notice and this permission notice shall be included in all
|
||||
//copies or substantial portions of the Software.
|
||||
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
//SOFTWARE.
|
||||
|
||||
using System;
|
||||
|
||||
namespace LiveCharts.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
/// Mapper to configure X and Y points
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to configure</typeparam>
|
||||
public class CartesianMapper<T> : IPointEvaluator<T>
|
||||
{
|
||||
private Func<T, int, double> _x = (v, i) => i;
|
||||
private Func<T, int, double> _y = (v, i) => i;
|
||||
private Func<T, int, object> _stroke;
|
||||
private Func<T, int, object> _fill;
|
||||
|
||||
/// <summary>
|
||||
/// Sets values for a specific point
|
||||
/// </summary>
|
||||
/// <param name="point">Point to set</param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="key"></param>
|
||||
public void Evaluate(int key, T value, ChartPoint point)
|
||||
{
|
||||
point.X = _x(value, key);
|
||||
point.Y = _y(value, key);
|
||||
if (_stroke != null) point.Stroke = _stroke(value, key);
|
||||
if (_fill != null) point.Fill = _fill(value, key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the X mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls X coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public CartesianMapper<T> X(Func<T, double> predicate)
|
||||
{
|
||||
return X((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the X mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls X coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public CartesianMapper<T> X(Func<T, int, double> predicate)
|
||||
{
|
||||
_x = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public CartesianMapper<T> Y(Func<T, double> predicate)
|
||||
{
|
||||
return Y((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public CartesianMapper<T> Y(Func<T, int, double> predicate)
|
||||
{
|
||||
_y = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public CartesianMapper<T> Stroke(Func<T, object> predicate)
|
||||
{
|
||||
return Stroke((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public CartesianMapper<T> Stroke(Func<T, int, object> predicate)
|
||||
{
|
||||
_stroke = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public CartesianMapper<T> Fill(Func<T, object> predicate)
|
||||
{
|
||||
return Fill((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public CartesianMapper<T> Fill(Func<T, int, object> predicate)
|
||||
{
|
||||
_fill = predicate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
176
Others/Live-Charts-master/Core/Configurations/FinancialMapper.cs
Normal file
176
Others/Live-Charts-master/Core/Configurations/FinancialMapper.cs
Normal file
@@ -0,0 +1,176 @@
|
||||
//The MIT License(MIT)
|
||||
|
||||
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
|
||||
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
|
||||
//The above copyright notice and this permission notice shall be included in all
|
||||
//copies or substantial portions of the Software.
|
||||
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
//SOFTWARE.
|
||||
|
||||
using System;
|
||||
|
||||
namespace LiveCharts.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
/// Mapper to configure financial points
|
||||
/// </summary>
|
||||
/// <typeparam name="T">type to configure</typeparam>
|
||||
public class FinancialMapper<T> : IPointEvaluator<T>
|
||||
{
|
||||
private Func<T, int, double> _x = (v, i) => i;
|
||||
private Func<T, int, double> _y = (v, i) => 0;
|
||||
private Func<T, int, double> _open;
|
||||
private Func<T, int, double> _high;
|
||||
private Func<T, int, double> _low;
|
||||
private Func<T, int, double> _close;
|
||||
|
||||
/// <summary>
|
||||
/// Sets values for a specific point
|
||||
/// </summary>
|
||||
/// <param name="point">Point to set</param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="key"></param>
|
||||
public void Evaluate(int key, T value, ChartPoint point)
|
||||
{
|
||||
point.X = _x(value, key);
|
||||
point.Y = _y(value, key);
|
||||
point.Open = _open(value, key);
|
||||
point.High = _high(value, key);
|
||||
point.Close = _close(value, key);
|
||||
point.Low = _low(value, key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps X value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls X coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> X(Func<T, double> predicate)
|
||||
{
|
||||
return X((t, i) => predicate(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// Maps X value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls X coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> X(Func<T, int, double> predicate)
|
||||
{
|
||||
_x = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps Y value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> Y(Func<T, double> predicate)
|
||||
{
|
||||
return Y((t, i) => predicate(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// Maps Y value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> Y(Func<T, int, double> predicate)
|
||||
{
|
||||
_y = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps Open value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls open value</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> Open(Func<T, double> predicate)
|
||||
{
|
||||
return Open((t, i) => predicate(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// Maps Open value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls open value, value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> Open(Func<T, int, double> predicate)
|
||||
{
|
||||
_open = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps High value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls High value</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> High(Func<T, double> predicate)
|
||||
{
|
||||
return High((t, i) => predicate(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// Maps High value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls High value</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> High(Func<T, int, double> predicate)
|
||||
{
|
||||
_high = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps Close value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls close value</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> Close(Func<T, double> predicate)
|
||||
{
|
||||
return Close((t, i) => predicate(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// Maps Close value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls close value, value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> Close(Func<T, int, double> predicate)
|
||||
{
|
||||
_close = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps Low value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls low value</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> Low(Func<T, double> predicate)
|
||||
{
|
||||
return Low((t, i) => predicate(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// Maps Low value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls low value, index and value as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public FinancialMapper<T> Low(Func<T, int, double> predicate)
|
||||
{
|
||||
_low = predicate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
184
Others/Live-Charts-master/Core/Configurations/GanttMapper.cs
Normal file
184
Others/Live-Charts-master/Core/Configurations/GanttMapper.cs
Normal file
@@ -0,0 +1,184 @@
|
||||
//The MIT License(MIT)
|
||||
|
||||
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
|
||||
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
|
||||
//The above copyright notice and this permission notice shall be included in all
|
||||
//copies or substantial portions of the Software.
|
||||
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
//SOFTWARE.
|
||||
|
||||
using System;
|
||||
|
||||
namespace LiveCharts.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
/// Mapper to configure X and Y points
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to configure</typeparam>
|
||||
public class GanttMapper<T> : IPointEvaluator<T>
|
||||
{
|
||||
private Func<T, int, double> _x = (v, i) => i;
|
||||
private Func<T, int, double> _y = (v, i) => i;
|
||||
private Func<T, int, double> _startX = (v, i) => 0;
|
||||
private Func<T, int, double> _startY = (v, i) => 0;
|
||||
private Func<T, int, object> _stroke;
|
||||
private Func<T, int, object> _fill;
|
||||
|
||||
/// <summary>
|
||||
/// Sets values for a specific point
|
||||
/// </summary>
|
||||
/// <param name="point">Point to set</param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="key"></param>
|
||||
public void Evaluate(int key, T value, ChartPoint point)
|
||||
{
|
||||
point.X = _x(value, key);
|
||||
point.Y = _y(value, key);
|
||||
point.XStart = _startX(value, key);
|
||||
point.YStart = _startY(value, key);
|
||||
if (_stroke != null) point.Stroke = _stroke(value, key);
|
||||
if (_fill != null) point.Fill = _fill(value, key);
|
||||
|
||||
point.EvaluatesGantt = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the X mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls X coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public GanttMapper<T> X(Func<T, double> predicate)
|
||||
{
|
||||
return X((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the X mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls X coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public GanttMapper<T> X(Func<T, int, double> predicate)
|
||||
{
|
||||
_x = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the XStart mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls X coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public GanttMapper<T> XStart(Func<T, double> predicate)
|
||||
{
|
||||
return XStart((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the XStart mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls X coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public GanttMapper<T> XStart(Func<T, int, double> predicate)
|
||||
{
|
||||
_startX = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public GanttMapper<T> Y(Func<T, double> predicate)
|
||||
{
|
||||
return Y((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public GanttMapper<T> Y(Func<T, int, double> predicate)
|
||||
{
|
||||
_y = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the YStart mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public GanttMapper<T> YStart(Func<T, double> predicate)
|
||||
{
|
||||
return YStart((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the YStart mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public GanttMapper<T> YStart(Func<T, int, double> predicate)
|
||||
{
|
||||
_startY = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public GanttMapper<T> Stroke(Func<T, object> predicate)
|
||||
{
|
||||
return Stroke((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public GanttMapper<T> Stroke(Func<T, int, object> predicate)
|
||||
{
|
||||
_stroke = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public GanttMapper<T> Fill(Func<T, object> predicate)
|
||||
{
|
||||
return Fill((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public GanttMapper<T> Fill(Func<T, int, object> predicate)
|
||||
{
|
||||
_fill = predicate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
//The MIT License(MIT)
|
||||
|
||||
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
|
||||
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
|
||||
//The above copyright notice and this permission notice shall be included in all
|
||||
//copies or substantial portions of the Software.
|
||||
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
//SOFTWARE.
|
||||
|
||||
namespace LiveCharts.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public interface IPointEvaluator<in T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Evaluates the specified key.
|
||||
/// </summary>
|
||||
/// <param name="key">The key.</param>
|
||||
/// <param name="value">The value.</param>
|
||||
/// <param name="point">The point.</param>
|
||||
void Evaluate(int key, T value, ChartPoint point);
|
||||
}
|
||||
}
|
||||
90
Others/Live-Charts-master/Core/Configurations/Mappers.cs
Normal file
90
Others/Live-Charts-master/Core/Configurations/Mappers.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
//The MIT License(MIT)
|
||||
|
||||
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
|
||||
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
|
||||
//The above copyright notice and this permission notice shall be included in all
|
||||
//copies or substantial portions of the Software.
|
||||
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
//SOFTWARE.
|
||||
|
||||
namespace LiveCharts.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the already built point mappers
|
||||
/// </summary>
|
||||
public static class Mappers
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a mapper to configure X, Y points
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to map</typeparam>
|
||||
/// <returns>A new cartesian mapper instance</returns>
|
||||
public static CartesianMapper<T> Xy<T>()
|
||||
{
|
||||
return new CartesianMapper<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a mapper to configure financial points
|
||||
/// </summary>
|
||||
/// <typeparam name="T">type to map</typeparam>
|
||||
/// <returns>a new financial mapper instance</returns>
|
||||
public static FinancialMapper<T> Financial<T>()
|
||||
{
|
||||
return new FinancialMapper<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a mapper to configure X, Y and Weight points
|
||||
/// </summary>
|
||||
/// <typeparam name="T">type to map</typeparam>
|
||||
/// <returns>a new weighted mapper instance</returns>
|
||||
public static WeightedMapper<T> Weighted<T>()
|
||||
{
|
||||
return new WeightedMapper<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Gantt Mapper
|
||||
/// </summary>
|
||||
/// <typeparam name="T">type to amp</typeparam>
|
||||
/// <returns>a new polar mapper insance</returns>
|
||||
public static GanttMapper<T> Gantt<T>()
|
||||
{
|
||||
return new GanttMapper<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a mapper to configure Radius and Angle
|
||||
/// </summary>
|
||||
/// <typeparam name="T">type to amp</typeparam>
|
||||
/// <returns>a new polar mapper insance</returns>
|
||||
public static PolarMapper<T> Polar<T>()
|
||||
{
|
||||
return new PolarMapper<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PGets a mapper to configure a pie chart
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static PieMapper<T> Pie<T>()
|
||||
{
|
||||
return new PieMapper<T>();
|
||||
}
|
||||
}
|
||||
}
|
||||
94
Others/Live-Charts-master/Core/Configurations/PieMapper.cs
Normal file
94
Others/Live-Charts-master/Core/Configurations/PieMapper.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
|
||||
namespace LiveCharts.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
/// Mapper to configure X and Y points
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type to configure</typeparam>
|
||||
public class PieMapper<T> : IPointEvaluator<T>
|
||||
{
|
||||
private readonly Func<T, int, double> _x = (v, i) => i;
|
||||
private Func<T, int, double> _y = (v, i) => i;
|
||||
private Func<T, int, object> _stroke;
|
||||
private Func<T, int, object> _fill;
|
||||
|
||||
/// <summary>
|
||||
/// Sets values for a specific point
|
||||
/// </summary>
|
||||
/// <param name="point">Point to set</param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="key"></param>
|
||||
public void Evaluate(int key, T value, ChartPoint point)
|
||||
{
|
||||
point.X = _x(value, key);
|
||||
point.Y = _y(value, key);
|
||||
if (_stroke != null) point.Stroke = _stroke(value, key);
|
||||
if (_fill != null) point.Fill = _fill(value, key);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public PieMapper<T> Value(Func<T, double> predicate)
|
||||
{
|
||||
return Value((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls Y coordinate, with value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public PieMapper<T> Value(Func<T, int, double> predicate)
|
||||
{
|
||||
_y = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public PieMapper<T> Stroke(Func<T, object> predicate)
|
||||
{
|
||||
return Stroke((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public PieMapper<T> Stroke(Func<T, int, object> predicate)
|
||||
{
|
||||
_stroke = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public PieMapper<T> Fill(Func<T, object> predicate)
|
||||
{
|
||||
return Fill((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public PieMapper<T> Fill(Func<T, int, object> predicate)
|
||||
{
|
||||
_fill = predicate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
134
Others/Live-Charts-master/Core/Configurations/PolarMapper.cs
Normal file
134
Others/Live-Charts-master/Core/Configurations/PolarMapper.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
//The MIT License(MIT)
|
||||
|
||||
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
|
||||
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
|
||||
//The above copyright notice and this permission notice shall be included in all
|
||||
//copies or substantial portions of the Software.
|
||||
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
//SOFTWARE.
|
||||
|
||||
using System;
|
||||
|
||||
namespace LiveCharts.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
/// Mapper to configure polar series
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public class PolarMapper<T> : IPointEvaluator<T>
|
||||
{
|
||||
private Func<T, int, double> _r;
|
||||
private Func<T, int, double> _angle;
|
||||
private Func<T, int, object> _stroke;
|
||||
private Func<T, int, object> _fill;
|
||||
|
||||
/// <summary>
|
||||
/// Sets values for a specific point
|
||||
/// </summary>
|
||||
/// <param name="point">Point to set</param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="key"></param>
|
||||
public void Evaluate(int key, T value, ChartPoint point)
|
||||
{
|
||||
point.Radius = _r(value, key);
|
||||
point.Angle = _angle(value, key);
|
||||
if (_stroke != null) point.Stroke = _stroke(value, key);
|
||||
if (_fill != null) point.Fill = _fill(value, key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps X value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the radius value</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public PolarMapper<T> Radius(Func<T, double> predicate)
|
||||
{
|
||||
return Radius((t, i) => predicate(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// Maps X value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the radius value, value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public PolarMapper<T> Radius(Func<T, int, double> predicate)
|
||||
{
|
||||
_r = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maps Y value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the angle value</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public PolarMapper<T> Angle(Func<T, double> predicate)
|
||||
{
|
||||
return Angle((t, i) => predicate(t));
|
||||
}
|
||||
/// <summary>
|
||||
/// Maps Y value
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the angle value, value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public PolarMapper<T> Angle(Func<T, int, double> predicate)
|
||||
{
|
||||
_angle = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public PolarMapper<T> Stroke(Func<T, object> predicate)
|
||||
{
|
||||
return Stroke((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public PolarMapper<T> Stroke(Func<T, int, object> predicate)
|
||||
{
|
||||
_stroke = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public PolarMapper<T> Fill(Func<T, object> predicate)
|
||||
{
|
||||
return Fill((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public PolarMapper<T> Fill(Func<T, int, object> predicate)
|
||||
{
|
||||
_fill = predicate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
159
Others/Live-Charts-master/Core/Configurations/WeightedMapper.cs
Normal file
159
Others/Live-Charts-master/Core/Configurations/WeightedMapper.cs
Normal file
@@ -0,0 +1,159 @@
|
||||
//The MIT License(MIT)
|
||||
|
||||
//Copyright(c) 2016 Alberto Rodriguez & LiveCharts Contributors
|
||||
|
||||
//Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
//of this software and associated documentation files (the "Software"), to deal
|
||||
//in the Software without restriction, including without limitation the rights
|
||||
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
//copies of the Software, and to permit persons to whom the Software is
|
||||
//furnished to do so, subject to the following conditions:
|
||||
|
||||
//The above copyright notice and this permission notice shall be included in all
|
||||
//copies or substantial portions of the Software.
|
||||
|
||||
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
//SOFTWARE.
|
||||
|
||||
using System;
|
||||
|
||||
namespace LiveCharts.Configurations
|
||||
{
|
||||
/// <summary>
|
||||
/// Mapper to configure Bubble points
|
||||
/// </summary>
|
||||
/// <typeparam name="T">type to configure</typeparam>
|
||||
public class WeightedMapper<T> : IPointEvaluator<T>
|
||||
{
|
||||
private Func<T, int, double> _x = (v, i) => i;
|
||||
private Func<T, int, double> _y = (v, i) => i;
|
||||
private Func<T, int, double> _weight = (v, i) => 0;
|
||||
private Func<T, int, object> _stroke;
|
||||
private Func<T, int, object> _fill;
|
||||
|
||||
/// <summary>
|
||||
/// Sets values for a specific point
|
||||
/// </summary>
|
||||
/// <param name="point">Point to set</param>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="key"></param>
|
||||
public void Evaluate(int key, T value, ChartPoint point)
|
||||
{
|
||||
point.X = _x(value, key);
|
||||
point.Y = _y(value, key);
|
||||
point.Weight = _weight(value, key);
|
||||
if (_stroke != null) point.Stroke = _stroke(value, key);
|
||||
if (_fill != null) point.Fill = _fill(value, key);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the X mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the X coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public WeightedMapper<T> X(Func<T, double> predicate)
|
||||
{
|
||||
return X((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the X mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the X coordinate, value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public WeightedMapper<T> X(Func<T, int, double> predicate)
|
||||
{
|
||||
_x = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the Y coordinate</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public WeightedMapper<T> Y(Func<T, double> predicate)
|
||||
{
|
||||
return Y((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Y mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the Y coordinate, value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public WeightedMapper<T> Y(Func<T, int, double> predicate)
|
||||
{
|
||||
_y = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets Weight mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the point's weight</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public WeightedMapper<T> Weight(Func<T, double> predicate)
|
||||
{
|
||||
return Weight((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets Weight mapper
|
||||
/// </summary>
|
||||
/// <param name="predicate">function that pulls the point's weight, value and index as parameters</param>
|
||||
/// <returns>current mapper instance</returns>
|
||||
public WeightedMapper<T> Weight(Func<T, int, double> predicate)
|
||||
{
|
||||
_weight = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public WeightedMapper<T> Stroke(Func<T, object> predicate)
|
||||
{
|
||||
return Stroke((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Stroke of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public WeightedMapper<T> Stroke(Func<T, int, object> predicate)
|
||||
{
|
||||
_stroke = predicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public WeightedMapper<T> Fill(Func<T, object> predicate)
|
||||
{
|
||||
return Fill((t, i) => predicate(t));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the Fill of the point
|
||||
/// </summary>
|
||||
/// <param name="predicate"></param>
|
||||
/// <returns></returns>
|
||||
public WeightedMapper<T> Fill(Func<T, int, object> predicate)
|
||||
{
|
||||
_fill = predicate;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user