mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 16:00:24 +00:00
v2.2.2
This commit is contained in:
@@ -12,7 +12,7 @@ namespace XCharts
|
||||
{
|
||||
public static DataZoom GetDataZoom(Serie serie, List<DataZoom> dataZooms)
|
||||
{
|
||||
if(serie == null) return null;
|
||||
if (serie == null) return null;
|
||||
foreach (var dataZoom in dataZooms)
|
||||
{
|
||||
if (!dataZoom.enable) continue;
|
||||
@@ -25,13 +25,36 @@ namespace XCharts
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void UpdateDataZoomRuntimeStartEndValue(DataZoom dataZoom, Serie serie){
|
||||
if(dataZoom == null || serie == null) return;
|
||||
public static void UpdateDataZoomRuntimeStartEndValue(DataZoom dataZoom, Serie serie)
|
||||
{
|
||||
if (dataZoom == null || serie == null) return;
|
||||
float min = 0;
|
||||
float max = 0;
|
||||
SerieHelper.GetMinMaxData(serie, out min, out max, null);
|
||||
dataZoom.runtimeStartValue = min + (max-min) * dataZoom.start / 100;
|
||||
dataZoom.runtimeEndValue = min +(max-min) * dataZoom.end / 100;
|
||||
dataZoom.runtimeStartValue = min + (max - min) * dataZoom.start / 100;
|
||||
dataZoom.runtimeEndValue = min + (max - min) * dataZoom.end / 100;
|
||||
}
|
||||
|
||||
public static void UpdateDataZoomRuntimeStartEndValue(List<DataZoom> dataZooms, Series series, SerieType serieType)
|
||||
{
|
||||
foreach (var dataZoom in dataZooms)
|
||||
{
|
||||
if (!dataZoom.enable) continue;
|
||||
float min = float.MaxValue;
|
||||
float max = float.MinValue;
|
||||
foreach (var serie in series.list)
|
||||
{
|
||||
if (!serie.show || serie.type != serieType) continue;
|
||||
if (!dataZoom.IsXAxisIndexValue(serie.xAxisIndex)) continue;
|
||||
var serieMinValue = 0f;
|
||||
var serieMaxValue = 0f;
|
||||
SerieHelper.GetMinMaxData(serie, out serieMinValue, out serieMaxValue, null, 2);
|
||||
if (serieMinValue < min) min = serieMinValue;
|
||||
if (serieMaxValue > max) max = serieMaxValue;
|
||||
}
|
||||
dataZoom.runtimeStartValue = min + (max - min) * dataZoom.start / 100;
|
||||
dataZoom.runtimeEndValue = min + (max - min) * dataZoom.end / 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace XCharts
|
||||
/// <param name="min"></param>
|
||||
/// <param name="max"></param>
|
||||
/// <param name="dataZoom"></param>
|
||||
public static void GetMinMaxData(Serie serie, out float min, out float max, DataZoom dataZoom = null)
|
||||
public static void GetMinMaxData(Serie serie, out float min, out float max, DataZoom dataZoom = null, int dimension = 0)
|
||||
{
|
||||
max = float.MinValue;
|
||||
min = float.MaxValue;
|
||||
@@ -58,7 +58,9 @@ namespace XCharts
|
||||
var serieData = dataList[i];
|
||||
if (serieData.show)
|
||||
{
|
||||
var count = serie.showDataDimension > serieData.data.Count
|
||||
var count = 0;
|
||||
if (dimension > 0) count = dimension;
|
||||
else count = serie.showDataDimension > serieData.data.Count
|
||||
? serieData.data.Count
|
||||
: serie.showDataDimension;
|
||||
for (int j = 0; j < count; j++)
|
||||
|
||||
Reference in New Issue
Block a user