Comments (2)
The startEndFunction
of DataZoom is a callback for when the start
and end
values of a DataZoom change. You can try using this function.
from xcharts.
Alright, i found how to get data from DataZoom:
// Set custom Y axis min-max values as +/- 1% of max/min values on screen candles
private void UpdateYAxisMinMaxValues()
{
var serie = chart.GetSerie(0);
chart.GetDataZoomOfSerie(serie, out DataZoom xDataZoom, out DataZoom yDataZoom);
// Returns timestamp as max value
//SerieHelper.GetMinMaxData(serie, out serieMinValue, out serieMaxValue, xDataZoom);
var serieDataList = serie.GetDataList(xDataZoom);
double serieMinValue = double.MaxValue;
double serieMaxValue = double.MinValue;
for (int i = 0; i < serieDataList.Count; i++)
{
var serieData = serieDataList[i];
var serieDataValues = serieData.data;
// serieDataValues[0] - Timestamp
// serieDataValues[1] - OpenPrice
// serieDataValues[2] - ClosePrice
// serieDataValues[3] - LowPrice
// serieDataValues[4] - HighPrice
var min = serieDataValues[3];
var max = serieDataValues[4];
if (min < serieMinValue) serieMinValue = min;
if (max > serieMaxValue) serieMaxValue = max;
}
var yAxis = chart.GetChartComponent<YAxis>(serie.yAxisIndex);
yAxis.type = Axis.AxisType.Value;
yAxis.minMaxType = Axis.AxisMinMaxType.Custom;
yAxis.ceilRate = (double)ceilRate;
serieMinValue = serieMinValue - (yAxisMinMaxOffsetInPercent / 100 * serieMinValue);
serieMaxValue = serieMaxValue + (yAxisMinMaxOffsetInPercent / 100 * serieMaxValue);
yAxis.min = ChartHelper.GetMinDivisibleValue(serieMinValue, ceilRate);
yAxis.max = ChartHelper.GetMaxDivisibleValue(serieMaxValue, ceilRate);
// Does not set min-max values, because initial values of min max is 0, AdjustMinMaxValue skips them on this line 'if (axis.min != 0 || axis.max != 0)'
//AxisHelper.AdjustMinMaxValue(yAxis, ref serieMinValue, ref serieMaxValue, true, yAxis.ceilRate);
}
Now how i should subscribe to OnDataZoomRangeChanged for updates when zoom changes?
For now i just check difference between previous and current values of DataZoom.start and DataZoom.end in update method, is there any other way? Delegate to subscribe for zoom updates maybe?
from xcharts.
Related Issues (20)
- DivideByZeroException: Attempted to divide by zero. HOT 1
- PieChart 中的 Legend ,使用 LabelStyle Formatter 显示 {d} 百分比 数值错误。
- 半透明饼图的阴影无法去除
- 折线图绘图区域背景颜色的问题 HOT 1
- The TooltipHandler creates GC garbage every frame
- Help with Candlesticks required HOT 3
- Question: Tooltip, Corss, Indicator Label does not shown if Tooltip component is not turned off/on in inspector. HOT 6
- Help with CandlestickChart GridLayout component required HOT 2
- Question: Multiple DataZooms interconnected HOT 1
- 堆叠面积图SetActive操作导致的程序卡死问题
- Removing Axis Component Throws An Error HOT 1
- 折线图第二根线,鼠标放上去后会消失
- Rebuild Chart Object have NullReferenceException HOT 1
- [Question]:数据奇异时的表现 HOT 3
- LineChart.Init() resizes Rectransform after creating background HOT 1
- Code error:linechart.AddSerie<Line>("line") HOT 2
- Radar Chart Tutorial
- 在微信小游戏中无法正常显示的问题 HOT 4
- get data from excel file and than will be a practical software HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xcharts.