diff --git a/Documentation~/en/api.md b/Documentation~/en/api.md index 167b4455..e939a50c 100644 --- a/Documentation~/en/api.md +++ b/Documentation~/en/api.md @@ -1,5 +1,5 @@ --- -sidebar_position: 3 +sidebar_position: 41 slug: /api --- @@ -7,48 +7,111 @@ slug: /api ## All Class -|||| -|--|--|--| -|[AnimationStyleHelper](#animationstylehelper)|[AxisContext](#axiscontext)|[AxisHandler<T>](#axishandlert)| -|[AxisHelper](#axishelper)|[BarChart](#barchart)|[BaseChart](#basechart)| -|[BaseGraph](#basegraph)|[CandlestickChart](#candlestickchart)|[ChartCached](#chartcached)| -|[ChartConst](#chartconst)|[ChartDrawer](#chartdrawer)|[ChartHelper](#charthelper)| -|[ChartLabel](#chartlabel)|[ChartObject](#chartobject)|[CheckHelper](#checkhelper)| -|[ColorUtil](#colorutil)|[ComponentHandlerAttribute](#componenthandlerattribute)|[ComponentHelper](#componenthelper)| -|[CoordOptionsAttribute](#coordoptionsattribute)|[DataZoomContext](#datazoomcontext)|[DataZoomHelper](#datazoomhelper)| -|[DateTimeUtil](#datetimeutil)|[DefaultAnimationAttribute](#defaultanimationattribute)|[DefineSymbolsUtil](#definesymbolsutil)| -|[FormatterHelper](#formatterhelper)|[GridCoordContext](#gridcoordcontext)|[HeatmapChart](#heatmapchart)| -|[IgnoreDoc](#ignoredoc)|[InteractData](#interactdata)|[LayerHelper](#layerhelper)| -|[LegendContext](#legendcontext)|[LegendHelper](#legendhelper)|[LegendItem](#legenditem)| -|[LineChart](#linechart)|[ListFor](#listfor)|[ListForComponent](#listforcomponent)| -|[ListForSerie](#listforserie)|[MainComponentContext](#maincomponentcontext)|[MainComponentHandler](#maincomponenthandler)| -|[MainComponentHandler<T>](#maincomponenthandlert)|[MathUtil](#mathutil)|[Painter](#painter)| -|[ParallelChart](#parallelchart)|[ParallelCoordContext](#parallelcoordcontext)|[PieChart](#piechart)| -|[PolarChart](#polarchart)|[PolarCoordContext](#polarcoordcontext)|[ProgressBar](#progressbar)| -|[PropertyUtil](#propertyutil)|[RadarChart](#radarchart)|[RadarCoordContext](#radarcoordcontext)| -|[ReflectionUtil](#reflectionutil)|[RequireChartComponentAttribute](#requirechartcomponentattribute)|[RingChart](#ringchart)| -|[RuntimeUtil](#runtimeutil)|[ScatterChart](#scatterchart)|[SerieContext](#seriecontext)| -|[SerieConvertAttribute](#serieconvertattribute)|[SerieDataContext](#seriedatacontext)|[SerieDataExtraComponentAttribute](#seriedataextracomponentattribute)| -|[SerieDataExtraFieldAttribute](#seriedataextrafieldattribute)|[SerieExtraComponentAttribute](#serieextracomponentattribute)|[SerieHandler](#seriehandler)| -|[SerieHandler<T>](#seriehandlert)|[SerieHandlerAttribute](#seriehandlerattribute)|[SerieHelper](#seriehelper)| -|[SerieLabelHelper](#serielabelhelper)|[SerieLabelPool](#serielabelpool)|[SerieParams](#serieparams)| -|[SeriesHelper](#serieshelper)|[SimplifiedBarChart](#simplifiedbarchart)|[SimplifiedCandlestickChart](#simplifiedcandlestickchart)| -|[SimplifiedLineChart](#simplifiedlinechart)|[Since](#since)|[SVG](#svg)| -|[SVGImage](#svgimage)|[SVGPath](#svgpath)|[SVGPathSeg](#svgpathseg)| -|[TooltipContext](#tooltipcontext)|[TooltipData](#tooltipdata)|[TooltipHelper](#tooltiphelper)| -|[TooltipView](#tooltipview)|[TooltipViewItem](#tooltipviewitem)|[UGL](#ugl)| -|[UGLExample](#uglexample)|[UGLHelper](#uglhelper)|[VisualMapContext](#visualmapcontext)| -|[VisualMapHelper](#visualmaphelper)|[XChartsMgr](#xchartsmgr)|[XCResourceImporterWindow](#xcresourceimporterwindow)| -|[XCThemeMgr](#xcthememgr)| +- [AnimationStyleHelper](#animationstylehelper) +- [AxisContext](#axiscontext) +- [AxisHandler<T>](#axishandlert) +- [AxisHelper](#axishelper) +- [BarChart](#barchart) +- [BaseChart](#basechart) +- [BaseGraph](#basegraph) +- [CandlestickChart](#candlestickchart) +- [ChartCached](#chartcached) +- [ChartConst](#chartconst) +- [ChartDrawer](#chartdrawer) +- [ChartHelper](#charthelper) +- [ChartLabel](#chartlabel) +- [ChartObject](#chartobject) +- [CheckHelper](#checkhelper) +- [ColorUtil](#colorutil) +- [ComponentHandlerAttribute](#componenthandlerattribute) +- [ComponentHelper](#componenthelper) +- [CoordOptionsAttribute](#coordoptionsattribute) +- [DataZoomContext](#datazoomcontext) +- [DataZoomHelper](#datazoomhelper) +- [DateTimeUtil](#datetimeutil) +- [DefaultAnimationAttribute](#defaultanimationattribute) +- [DefineSymbolsUtil](#definesymbolsutil) +- [FormatterHelper](#formatterhelper) +- [GridCoordContext](#gridcoordcontext) +- [HeatmapChart](#heatmapchart) +- [IgnoreDoc](#ignoredoc) +- [InputHelper](#inputhelper) +- [InteractData](#interactdata) +- [LayerHelper](#layerhelper) +- [LegendContext](#legendcontext) +- [LegendHelper](#legendhelper) +- [LegendItem](#legenditem) +- [LineChart](#linechart) +- [ListFor](#listfor) +- [ListForComponent](#listforcomponent) +- [ListForSerie](#listforserie) +- [MainComponentContext](#maincomponentcontext) +- [MainComponentHandler](#maincomponenthandler) +- [MainComponentHandler<T>](#maincomponenthandlert) +- [MathUtil](#mathutil) +- [Painter](#painter) +- [ParallelChart](#parallelchart) +- [ParallelCoordContext](#parallelcoordcontext) +- [PieChart](#piechart) +- [PolarChart](#polarchart) +- [PolarCoordContext](#polarcoordcontext) +- [PropertyUtil](#propertyutil) +- [RadarChart](#radarchart) +- [RadarCoordContext](#radarcoordcontext) +- [ReflectionUtil](#reflectionutil) +- [RequireChartComponentAttribute](#requirechartcomponentattribute) +- [RingChart](#ringchart) +- [RuntimeUtil](#runtimeutil) +- [ScatterChart](#scatterchart) +- [SerieComponentAttribute](#seriecomponentattribute) +- [SerieContext](#seriecontext) +- [SerieConvertAttribute](#serieconvertattribute) +- [SerieDataComponentAttribute](#seriedatacomponentattribute) +- [SerieDataContext](#seriedatacontext) +- [SerieDataExtraFieldAttribute](#seriedataextrafieldattribute) +- [SerieEventData](#serieeventdata) +- [SerieEventDataPool](#serieeventdatapool) +- [SerieHandler](#seriehandler) +- [SerieHandler<T>](#seriehandlert) +- [SerieHandlerAttribute](#seriehandlerattribute) +- [SerieHelper](#seriehelper) +- [SerieLabelHelper](#serielabelhelper) +- [SerieLabelPool](#serielabelpool) +- [SerieParams](#serieparams) +- [SeriesHelper](#serieshelper) +- [SimplifiedBarChart](#simplifiedbarchart) +- [SimplifiedCandlestickChart](#simplifiedcandlestickchart) +- [SimplifiedLineChart](#simplifiedlinechart) +- [Since](#since) +- [SVG](#svg) +- [SVGImage](#svgimage) +- [SVGPath](#svgpath) +- [SVGPathSeg](#svgpathseg) +- [TooltipContext](#tooltipcontext) +- [TooltipData](#tooltipdata) +- [TooltipHelper](#tooltiphelper) +- [TooltipView](#tooltipview) +- [TooltipViewItem](#tooltipviewitem) +- [UGL](#ugl) +- [UGLExample](#uglexample) +- [UGLHelper](#uglhelper) +- [UIComponent](#uicomponent) +- [UIHelper](#uihelper) +- [VisualMapContext](#visualmapcontext) +- [VisualMapHelper](#visualmaphelper) +- [XChartsMgr](#xchartsmgr) +- [XCResourceImporterWindow](#xcresourceimporterwindow) +- [XCThemeMgr](#xcthememgr) + ## AnimationStyleHelper -|public method|description| -|--|--| -| CheckDataAnimation() |public static float CheckDataAnimation(BaseChart chart, Serie serie, int dataIndex, float destProgress, float startPorgress = 0)| -| GetAnimationPosition() |public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)| -| UpdateAnimationType() |public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType)| -| UpdateSerieAnimation() |public static void UpdateSerieAnimation(Serie serie)| +|public method|since|description| +|--|--|--| +|CheckDataAnimation()||public static float CheckDataAnimation(BaseChart chart, Serie serie, int dataIndex, float destProgress, float startPorgress = 0)| +|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)| +|UpdateAnimationType()||public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType)| +|UpdateSerieAnimation()||public static void UpdateSerieAnimation(Serie serie)| ## AxisContext @@ -60,29 +123,29 @@ Inherits or Implemented: [MainComponentHandler](#maincomponenthandler) ## AxisHelper -|public method|description| -|--|--| -| AdjustCircleLabelPos() |public static void AdjustCircleLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)| -| AdjustMinMaxValue() |public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, double ceilRate = 0)
调整最大最小值 | -| AdjustRadiusAxisLabelPos() |public static void AdjustRadiusAxisLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)| -| GetAxisLineArrowOffset() |public static float GetAxisLineArrowOffset(Axis axis)
包含箭头偏移的轴线长度 | -| GetAxisPosition() |public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)| -| GetAxisPositionValue() |public static double GetAxisPositionValue(float xy, float axisLength, double axisRange, float axisStart, float axisOffset)| -| GetAxisPositionValue() |public static double GetAxisPositionValue(GridCoord grid, Axis axis, Vector3 pos)| -| GetAxisValueDistance() |public static float GetAxisValueDistance(GridCoord grid, Axis axis, float scaleWidth, double value)
获得数值value在坐标轴上相对起点的距离 | -| GetAxisValueLength() |public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value)
获得数值value在坐标轴上对应的长度 | -| GetAxisValuePosition() |public static float GetAxisValuePosition(GridCoord grid, Axis axis, float scaleWidth, double value)
获得数值value在坐标轴上的坐标位置 | -| GetAxisValueSplitIndex() |public static int GetAxisValueSplitIndex(Axis axis, double value, int totalSplitNumber = -1)
获得数值value在坐标轴上对应的split索引 | -| GetAxisXOrY() |public static float GetAxisXOrY(GridCoord grid, Axis axis, Axis relativedAxis)| -| GetDataWidth() |public static float GetDataWidth(Axis axis, float coordinateWidth, int dataCount, DataZoom dataZoom)
获得一个类目数据在坐标系中代表的宽度 | -| GetEachWidth() |public static float GetEachWidth(Axis axis, float coordinateWidth, DataZoom dataZoom = null)| -| GetScaleNumber() |public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
获得分割线条数 | -| GetScaleWidth() |public static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)
获得分割段宽度 | -| GetSplitNumber() |public static int GetSplitNumber(Axis axis, float coordinateWid, DataZoom dataZoom)
获得分割段数 | -| GetTotalSplitGridNum() |public static int GetTotalSplitGridNum(Axis axis)
获得分割网格个数,包含次刻度 | -| GetXAxisXOrY() |public static float GetXAxisXOrY(GridCoord grid, Axis xAxis, Axis relativedAxis)| -| GetYAxisXOrY() |public static float GetYAxisXOrY(GridCoord grid, Axis yAxis, Axis relativedAxis)| -| NeedShowSplit() |public static bool NeedShowSplit(Axis axis)| +|public method|since|description| +|--|--|--| +|AdjustCircleLabelPos()||public static void AdjustCircleLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)| +|AdjustMinMaxValue()||public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, double ceilRate = 0)
调整最大最小值 | +|AdjustRadiusAxisLabelPos()||public static void AdjustRadiusAxisLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)| +|GetAxisLineArrowOffset()||public static float GetAxisLineArrowOffset(Axis axis)
包含箭头偏移的轴线长度 | +|GetAxisPosition()||public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)| +|GetAxisPositionValue()||public static double GetAxisPositionValue(float xy, float axisLength, double axisRange, float axisStart, float axisOffset)| +|GetAxisPositionValue()||public static double GetAxisPositionValue(GridCoord grid, Axis axis, Vector3 pos)| +|GetAxisValueDistance()||public static float GetAxisValueDistance(GridCoord grid, Axis axis, float scaleWidth, double value)
获得数值value在坐标轴上相对起点的距离 | +|GetAxisValueLength()||public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value)
获得数值value在坐标轴上对应的长度 | +|GetAxisValuePosition()||public static float GetAxisValuePosition(GridCoord grid, Axis axis, float scaleWidth, double value)
获得数值value在坐标轴上的坐标位置 | +|GetAxisValueSplitIndex()||public static int GetAxisValueSplitIndex(Axis axis, double value, int totalSplitNumber = -1)
获得数值value在坐标轴上对应的split索引 | +|GetAxisXOrY()||public static float GetAxisXOrY(GridCoord grid, Axis axis, Axis relativedAxis)| +|GetDataWidth()||public static float GetDataWidth(Axis axis, float coordinateWidth, int dataCount, DataZoom dataZoom)
获得一个类目数据在坐标系中代表的宽度 | +|GetEachWidth()||public static float GetEachWidth(Axis axis, float coordinateWidth, DataZoom dataZoom = null)| +|GetScaleNumber()||public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)
获得分割线条数 | +|GetScaleWidth()||public static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)
获得分割段宽度 | +|GetSplitNumber()||public static int GetSplitNumber(Axis axis, float coordinateWid, DataZoom dataZoom)
获得分割段数 | +|GetTotalSplitGridNum()||public static int GetTotalSplitGridNum(Axis axis)
获得分割网格个数,包含次刻度 | +|GetXAxisXOrY()||public static float GetXAxisXOrY(GridCoord grid, Axis xAxis, Axis relativedAxis)| +|GetYAxisXOrY()||public static float GetYAxisXOrY(GridCoord grid, Axis yAxis, Axis relativedAxis)| +|NeedShowSplit()||public static bool NeedShowSplit(Axis axis)| ## BarChart @@ -92,194 +155,222 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [BaseGraph](#basegraph),[ISerializationCallbackReceiver](#iserializationcallbackreceiver) -|public method|description| -|--|--| -| AddChartComponent() |public MainComponent AddChartComponent(Type type)| -| AddChartComponent<T>() |public T AddChartComponent<T>() where T : MainComponent| -| AddChartComponentWhenNoExist<T>() |public T AddChartComponentWhenNoExist<T>() where T : MainComponent| -| AddData() |public SerieData AddData(int serieIndex, DateTime time, double yValue, string dataName = null, string dataId = null)
Add a (time,y) data to serie. | -| AddData() |public SerieData AddData(int serieIndex, double data, string dataName = null, string dataId = null)
Add a data to serie. | -| AddData() |public SerieData AddData(int serieIndex, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)| -| AddData() |public SerieData AddData(int serieIndex, double xValue, double yValue, string dataName = null, string dataId = null)
Add a (x,y) data to serie. | -| AddData() |public SerieData AddData(int serieIndex, List<double> multidimensionalData, string dataName = null, string dataId = null)
Add an arbitray dimension data to serie,such as (x,y,z,...). | -| AddData() |public SerieData AddData(int serieIndex, params double[] multidimensionalData)
Add an arbitray dimension data to serie,such as (x,y,z,...). | -| AddData() |public SerieData AddData(string serieName, DateTime time, double yValue, string dataName = null, string dataId = null)
Add a (time,y) data to serie. | -| AddData() |public SerieData AddData(string serieName, double data, string dataName = null, string dataId = null)
Add a data to serie. | -| AddData() |public SerieData AddData(string serieName, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)| -| AddData() |public SerieData AddData(string serieName, double xValue, double yValue, string dataName = null, string dataId = null)
Add a (x,y) data to serie. | -| AddData() |public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null, string dataId = null)
Add an arbitray dimension data to serie,such as (x,y,z,...). | -| AddData() |public SerieData AddData(string serieName, params double[] multidimensionalData)
Add an arbitray dimension data to serie,such as (x,y,z,...). | -| AddSerie<T>() |public T AddSerie<T>(string serieName = null, bool show = true, bool addToHead = false) where T : Serie| -| AddXAxisData() |public void AddXAxisData(string category, int xAxisIndex = 0)
Add a category data to xAxis. | -| AddXAxisIcon() |public void AddXAxisIcon(Sprite icon, int xAxisIndex = 0)
Add an icon to xAxis. | -| AddYAxisData() |public void AddYAxisData(string category, int yAxisIndex = 0)
Add a category data to yAxis. | -| AddYAxisIcon() |public void AddYAxisIcon(Sprite icon, int yAxisIndex = 0)
Add an icon to yAxis. | -| AnimationEnable() |public void AnimationEnable(bool flag)
Whether series animation enabel. | -| AnimationFadeIn() |public void AnimationFadeIn(bool reset = true)
fadeIn animation. | -| AnimationFadeOut() |public void AnimationFadeOut()
fadeIn animation. | -| AnimationPause() |public void AnimationPause()
Pause animation. | -| AnimationReset() |public void AnimationReset()
Reset animation. | -| AnimationResume() |public void AnimationResume()
Stop play animation. | -| CanAddChartComponent() |public bool CanAddChartComponent(Type type)| -| CanAddSerie() |public bool CanAddSerie(Type type)| -| CanAddSerie<T>() |public bool CanAddSerie<T>() where T : Serie| -| CanMultipleComponent() |public bool CanMultipleComponent(Type type)| -| ClampInChart() |public void ClampInChart(ref Vector3 pos)| -| ClampInGrid() |public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)| -| ClearComponentData() |public virtual void ClearComponentData()
Clear the data of all components. | -| ClearData() |public virtual void ClearData()
Clear all components and series data. Note: serie only empties the data and does not remove serie. | -| ClearSerieData() |public virtual void ClearSerieData()
Clear the data of all series. | -| ClickLegendButton() |public void ClickLegendButton(int legendIndex, string legendName, bool show)
点击图例按钮 | -| CovertSerie() |public bool CovertSerie(Serie serie, Type type)| -| CovertSerie<T>() |public bool CovertSerie<T>(Serie serie) where T : Serie| -| CovertXYAxis() |public void CovertXYAxis(int index)
转换X轴和Y轴的配置 | -| GenerateDefaultSerieName() |public string GenerateDefaultSerieName()| -| GetAllSerieDataCount() |public int GetAllSerieDataCount()| -| GetChartBackgroundColor() |public Color32 GetChartBackgroundColor()| -| GetChartComponent<T>() |public T GetChartComponent<T>(int index = 0) where T : MainComponent| -| GetChartComponentNum() |public int GetChartComponentNum(Type type)| -| GetChartComponentNum<T>() |public int GetChartComponentNum<T>() where T : MainComponent| -| GetChartComponents<T>() |public List<MainComponent> GetChartComponents<T>() where T : MainComponent| -| GetData() |public double GetData(int serieIndex, int dataIndex, int dimension = 1)| -| GetData() |public double GetData(string serieName, int dataIndex, int dimension = 1)| -| GetDataZoomOfAxis() |public DataZoom GetDataZoomOfAxis(Axis axis)| -| GetDataZoomOfSerie() |public void GetDataZoomOfSerie(Serie serie, out DataZoom xDataZoom, out DataZoom yDataZoom)| -| GetGrid() |public GridCoord GetGrid(Vector2 local)| -| GetGridOfDataZoom() |public GridCoord GetGridOfDataZoom(DataZoom dataZoom)| -| GetItemColor() |public Color32 GetItemColor(Serie serie)| -| GetItemColor() |public Color32 GetItemColor(Serie serie, SerieData serieData)| -| GetItemColor() |public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)| -| GetLegendRealShowNameColor() |public Color32 GetLegendRealShowNameColor(string name)| -| GetLegendRealShowNameIndex() |public int GetLegendRealShowNameIndex(string name)| -| GetMarkColor() |public Color32 GetMarkColor(Serie serie, SerieData serieData)
获得Serie的标识颜色。 | -| GetOrAddChartComponent<T>() |public T GetOrAddChartComponent<T>() where T : MainComponent| -| GetPainter() |public Painter GetPainter(int index)| -| GetSerie() |public Serie GetSerie(int serieIndex)| -| GetSerie() |public Serie GetSerie(string serieName)| -| GetSerie<T>() |public T GetSerie<T>() where T : Serie| -| GetSerie<T>() |public T GetSerie<T>(int serieIndex) where T : Serie| -| GetSerieBarGap<T>() |public float GetSerieBarGap<T>() where T : Serie| -| GetSerieBarRealCount<T>() |public int GetSerieBarRealCount<T>() where T : Serie| -| GetSerieIndexIfStack<T>() |public int GetSerieIndexIfStack<T>(Serie currSerie) where T : Serie| -| GetSerieSameStackTotalValue<T>() |public double GetSerieSameStackTotalValue<T>(string stack, int dataIndex) where T : Serie| -| GetSeriesMinMaxValue() |public virtual void GetSeriesMinMaxValue(Axis axis, int axisIndex, out double tempMinValue, out double tempMaxValue)| -| GetSerieTotalGap<T>() |public float GetSerieTotalGap<T>(float categoryWidth, float gap, int index) where T : Serie| -| GetSerieTotalWidth<T>() |public float GetSerieTotalWidth<T>(float categoryWidth, float gap, int realBarCount) where T : Serie| -| GetTitlePosition() |public Vector3 GetTitlePosition(Title title)| -| GetVisualMapOfSerie() |public VisualMap GetVisualMapOfSerie(Serie serie)| -| GetXDataZoomOfSerie() |public DataZoom GetXDataZoomOfSerie(Serie serie)| -| GetXLerpColor() |public Color32 GetXLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, GridCoord grid)| -| GetYLerpColor() |public Color32 GetYLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, GridCoord grid)| -| HasChartComponent() |public bool HasChartComponent(Type type)| -| HasChartComponent<T>() |public bool HasChartComponent<T>()| -| HasSerie() |public bool HasSerie(Type type)| -| HasSerie<T>() |public bool HasSerie<T>() where T : Serie| -| Init() |public void Init(bool defaultChart = true)| -| InitAxisRuntimeData() |public virtual void InitAxisRuntimeData(Axis axis) { }| -| InsertSerie() |public void InsertSerie(Serie serie, int index = -1, bool addToHead = false)| -| InsertSerie<T>() |public T InsertSerie<T>(int index, string serieName = null, bool show = true) where T : Serie| -| Internal_CheckAnimation() |public void Internal_CheckAnimation()| -| IsActiveByLegend() |public virtual bool IsActiveByLegend(string legendName)
Whether serie is activated. | -| IsAllAxisCategory() |public bool IsAllAxisCategory()
纯类目轴。 | -| IsAllAxisValue() |public bool IsAllAxisValue()
reutrn true when all the show axis is `Value` type. | -| IsInAnyGrid() |public bool IsInAnyGrid(Vector2 local)| -| IsInChart() |public bool IsInChart(float x, float y)| -| IsInChart() |public bool IsInChart(Vector2 local)
坐标是否在图表范围内 | -| IsSerieName() |public bool IsSerieName(string name)| -| MoveDownSerie() |public bool MoveDownSerie(int serieIndex)| -| MoveUpSerie() |public bool MoveUpSerie(int serieIndex)| -| OnAfterDeserialize() |public void OnAfterDeserialize()| -| OnBeforeSerialize() |public void OnBeforeSerialize()| -| OnBeginDrag() |public override void OnBeginDrag(PointerEventData eventData)| -| OnDataZoomRangeChanged() |public virtual void OnDataZoomRangeChanged(DataZoom dataZoom)| -| OnDrag() |public override void OnDrag(PointerEventData eventData)| -| OnEndDrag() |public override void OnEndDrag(PointerEventData eventData)| -| OnLegendButtonClick() |public virtual void OnLegendButtonClick(int index, string legendName, bool show)| -| OnLegendButtonEnter() |public virtual void OnLegendButtonEnter(int index, string legendName)| -| OnLegendButtonExit() |public virtual void OnLegendButtonExit(int index, string legendName)| -| OnPointerClick() |public override void OnPointerClick(PointerEventData eventData)| -| OnPointerDown() |public override void OnPointerDown(PointerEventData eventData)| -| OnPointerEnter() |public override void OnPointerEnter(PointerEventData eventData)| -| OnPointerExit() |public override void OnPointerExit(PointerEventData eventData)| -| OnPointerUp() |public override void OnPointerUp(PointerEventData eventData)| -| OnScroll() |public override void OnScroll(PointerEventData eventData)| -| RefreshBasePainter() |public void RefreshBasePainter()| -| RefreshChart() |public void RefreshChart()
Redraw chart in next frame. | -| RefreshChart() |public void RefreshChart(int serieIndex)
Redraw chart serie in next frame. | -| RefreshChart() |public void RefreshChart(Serie serie)
Redraw chart serie in next frame. | -| RefreshDataZoom() |public void RefreshDataZoom()
在下一帧刷新DataZoom | -| RefreshGraph() |public override void RefreshGraph()| -| RefreshPainter() |public void RefreshPainter(int index)| -| RefreshPainter() |public void RefreshPainter(Serie serie)| -| RefreshTopPainter() |public void RefreshTopPainter()| -| RefreshUpperPainter() |public void RefreshUpperPainter()| -| RemoveAllChartComponent() |public void RemoveAllChartComponent()| -| RemoveAllSerie() |public virtual void RemoveAllSerie()
Remove all of them Serie. This interface is used when Serie needs to be removed only, and RemoveData() is generally used in other cases. | -| RemoveChartComponent() |public bool RemoveChartComponent(MainComponent component)| -| RemoveChartComponent() |public bool RemoveChartComponent(Type type, int index = 0)| -| RemoveChartComponent<T>() |public bool RemoveChartComponent<T>(int index = 0)| -| RemoveChartComponents() |public int RemoveChartComponents(Type type)| -| RemoveChartComponents<T>() |public int RemoveChartComponents<T>()| -| RemoveData() |public virtual void RemoveData()
Empty all component data and remove all series. Use the chart again and again to tell the truth. Note: The component only clears the data part, and the parameters are retained and not reset. | -| RemoveData() |public virtual void RemoveData(string serieName)
Remove legend and serie by name. | -| RemoveSerie() |public void RemoveSerie(int serieIndex)| -| RemoveSerie() |public void RemoveSerie(Serie serie)| -| RemoveSerie() |public void RemoveSerie(string serieName)| -| RemoveSerie<T>() |public void RemoveSerie<T>() where T : Serie| -| ReplaceSerie() |public bool ReplaceSerie(Serie oldSerie, Serie newSerie)| -| ResetDataIndex() |public bool ResetDataIndex(int serieIndex)
重置serie的数据项索引。避免数据项索引异常。 | -| SaveAsImage() |public void SaveAsImage(string imageType = "png", string savePath = "")
保存图表为图片。 | -| SetBasePainterMaterial() |public void SetBasePainterMaterial(Material material)
设置Base Painter的材质球 | -| SetMaxCache() |public void SetMaxCache(int maxCache)
设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 | -| SetPainterActive() |public void SetPainterActive(int index, bool flag)| -| SetSerieActive() |public void SetSerieActive(int serieIndex, bool active)
Whether to show serie. | -| SetSerieActive() |public void SetSerieActive(Serie serie, bool active)| -| SetSerieActive() |public void SetSerieActive(string serieName, bool active)
Whether to show serie. | -| SetSeriePainterMaterial() |public void SetSeriePainterMaterial(Material material)
设置Serie Painter的材质球 | -| SetTopPainterMaterial() |public void SetTopPainterMaterial(Material material)
设置Top Painter的材质球 | -| SetUpperPainterMaterial() |public void SetUpperPainterMaterial(Material material)
设置Upper Painter的材质球 | -| TryAddChartComponent() |public bool TryAddChartComponent(Type type)| -| TryAddChartComponent<T>() |public bool TryAddChartComponent<T>() where T : MainComponent| -| TryAddChartComponent<T>() |public bool TryAddChartComponent<T>(out T component) where T : MainComponent| -| TryGetChartComponent<T>() |public bool TryGetChartComponent<T>(out T component, int index = 0)| -| UpdateData() |public bool UpdateData(int serieIndex, int dataIndex, double value)
Update serie data by serie index. | -| UpdateData() |public bool UpdateData(int serieIndex, int dataIndex, int dimension, double value)
更新指定系列指定索引指定维数的数据。维数从0开始。 | -| UpdateData() |public bool UpdateData(int serieIndex, int dataIndex, List<double> multidimensionalData)
更新指定系列指定索引的数据项的多维数据。 | -| UpdateData() |public bool UpdateData(string serieName, int dataIndex, double value)
Update serie data by serie name. | -| UpdateData() |public bool UpdateData(string serieName, int dataIndex, int dimension, double value)
更新指定系列指定索引指定维数的数据。维数从0开始。 | -| UpdateData() |public bool UpdateData(string serieName, int dataIndex, List<double> multidimensionalData)
更新指定系列指定索引的数据项的多维数据。 | -| UpdateDataName() |public bool UpdateDataName(int serieIndex, int dataIndex, string dataName)
Update serie data name. | -| UpdateDataName() |public bool UpdateDataName(string serieName, int dataIndex, string dataName)
Update serie data name. | -| UpdateLegendColor() |public virtual void UpdateLegendColor(string legendName, bool active)| -| UpdateTheme() |public bool UpdateTheme(ThemeType theme)
Update chart theme. | -| UpdateTheme() |public void UpdateTheme(Theme theme)
Update chart theme info. | -| UpdateXAxisData() |public void UpdateXAxisData(int index, string category, int xAxisIndex = 0)
Update category data. | -| UpdateXAxisIcon() |public void UpdateXAxisIcon(int index, Sprite icon, int xAxisIndex = 0)
Update xAxis icon. | -| UpdateYAxisData() |public void UpdateYAxisData(int index, string category, int yAxisIndex = 0)
Update category data. | -| UpdateYAxisIcon() |public void UpdateYAxisIcon(int index, Sprite icon, int yAxisIndex = 0)
更新Y轴图标。 | +|public method|since|description| +|--|--|--| +|onAxisPointerValueChanged||public Action<Axis, double> onAxisPointerValueChanged
坐标轴变更数据索引时回调。参数:axis, dataIndex/dataValue | +|onDraw||public Action<VertexHelper> onDraw
自定义绘制回调。在绘制Serie前调用。 | +|onDrawAfterSerie||public Action<VertexHelper, Serie> onDrawAfterSerie
自定义Serie绘制回调。在每个Serie绘制完后调用。 | +|onDrawBeforeSerie||public Action<VertexHelper, Serie> onDrawBeforeSerie
自定义Serie绘制回调。在每个Serie绘制完前调用。 | +|onDrawTop||public Action<VertexHelper> onDrawTop
自定义Top层绘制回调。在绘制Tooltip前调用。 | +|onDrawUpper||public Action<VertexHelper> onDrawUpper
自定义Upper层绘制回调。在绘制Tooltip前调用。 | +|onInit||public Action onInit
The callback function of chart init. | +|onLegendClick||public Action<Legend, int, string, bool> onLegendClick
the callback function of click legend. | +|onLegendEnter||public Action<Legend, int, string> onLegendEnter
the callback function of enter legend. | +|onLegendExit||public Action<Legend, int, string> onLegendExit
the callback function of exit legend. | +|onPointerClickBar||public Action<PointerEventData, int> onPointerClickBar
the callback function of click bar. | +|onPointerClickPie||public Action<PointerEventData, int, int> onPointerClickPie
the callback function of pointer click pie area. | +|onPointerEnterPie||public Action<int, int> onPointerEnterPie
the callback function of pointer enter pie area. | +|onSerieClick|v3.6.0|public Action<SerieEventData> onSerieClick
the callback function of pointer click serie. | +|onSerieDown|v3.6.0|public Action<SerieEventData> onSerieDown
the callback function of pointer down serie. | +|onSerieEnter|v3.6.0|public Action<SerieEventData> onSerieEnter
the callback function of pointer enter serie. | +|onSerieExit|v3.6.0|public Action<SerieEventData> onSerieExit
the callback function of pointer exit serie. | +|onUpdate||public Action onUpdate
The callback function of chart update. | +|AddChartComponent()||public MainComponent AddChartComponent(Type type)| +|AddChartComponent<T>()||public T AddChartComponent<T>() where T : MainComponent| +|AddChartComponentWhenNoExist<T>()||public T AddChartComponentWhenNoExist<T>() where T : MainComponent| +|AddData()||public SerieData AddData(int serieIndex, DateTime time, double yValue, string dataName = null, string dataId = null)
Add a (time,y) data to serie. | +|AddData()||public SerieData AddData(int serieIndex, double data, string dataName = null, string dataId = null)
Add a data to serie. | +|AddData()||public SerieData AddData(int serieIndex, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)| +|AddData()||public SerieData AddData(int serieIndex, double xValue, double yValue, string dataName = null, string dataId = null)
Add a (x,y) data to serie. | +|AddData()||public SerieData AddData(int serieIndex, List<double> multidimensionalData, string dataName = null, string dataId = null)
Add an arbitray dimension data to serie,such as (x,y,z,...). | +|AddData()||public SerieData AddData(int serieIndex, params double[] multidimensionalData)
Add an arbitray dimension data to serie,such as (x,y,z,...). | +|AddData()||public SerieData AddData(string serieName, DateTime time, double yValue, string dataName = null, string dataId = null)
Add a (time,y) data to serie. | +|AddData()||public SerieData AddData(string serieName, double data, string dataName = null, string dataId = null)
Add a data to serie. | +|AddData()||public SerieData AddData(string serieName, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)| +|AddData()||public SerieData AddData(string serieName, double xValue, double yValue, string dataName = null, string dataId = null)
Add a (x,y) data to serie. | +|AddData()||public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null, string dataId = null)
Add an arbitray dimension data to serie,such as (x,y,z,...). | +|AddData()||public SerieData AddData(string serieName, params double[] multidimensionalData)
Add an arbitray dimension data to serie,such as (x,y,z,...). | +|AddSerie<T>()||public T AddSerie<T>(string serieName = null, bool show = true, bool addToHead = false) where T : Serie| +|AddXAxisData()||public void AddXAxisData(string category, int xAxisIndex = 0)
Add a category data to xAxis. | +|AddXAxisIcon()||public void AddXAxisIcon(Sprite icon, int xAxisIndex = 0)
Add an icon to xAxis. | +|AddYAxisData()||public void AddYAxisData(string category, int yAxisIndex = 0)
Add a category data to yAxis. | +|AddYAxisIcon()||public void AddYAxisIcon(Sprite icon, int yAxisIndex = 0)
Add an icon to yAxis. | +|AnimationEnable()||public void AnimationEnable(bool flag)
Whether series animation enabel. | +|AnimationFadeIn()||public void AnimationFadeIn(bool reset = true)
fadeIn animation. | +|AnimationFadeOut()||public void AnimationFadeOut()
fadeIn animation. | +|AnimationPause()||public void AnimationPause()
Pause animation. | +|AnimationReset()||public void AnimationReset()
Reset animation. | +|AnimationResume()||public void AnimationResume()
Stop play animation. | +|CanAddChartComponent()||public bool CanAddChartComponent(Type type)| +|CanAddSerie()||public bool CanAddSerie(Type type)| +|CanAddSerie<T>()||public bool CanAddSerie<T>() where T : Serie| +|CanMultipleComponent()||public bool CanMultipleComponent(Type type)| +|ClampInChart()||public void ClampInChart(ref Vector3 pos)| +|ClampInGrid()||public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)| +|ClearComponentData()||public virtual void ClearComponentData()
Clear the data of all components. | +|ClearData()||public virtual void ClearData()
Clear all components and series data. Note: serie only empties the data and does not remove serie. | +|ClearSerieData()||public virtual void ClearSerieData()
Clear the data of all series. | +|ClickLegendButton()||public void ClickLegendButton(int legendIndex, string legendName, bool show)
点击图例按钮 | +|ConvertSerie()||public bool ConvertSerie(Serie serie, Type type)| +|ConvertSerie<T>()||public bool ConvertSerie<T>(Serie serie) where T : Serie| +|ConvertXYAxis()||public void ConvertXYAxis(int index)
转换X轴和Y轴的配置 | +|EnsureChartComponent<T>()|v3.6.0|public T EnsureChartComponent<T>() where T : MainComponent
Ensure the chart has the component, if not, add it. Note: it may fail to add. | +|GenerateDefaultSerieName()||public string GenerateDefaultSerieName()| +|GetAllSerieDataCount()||public int GetAllSerieDataCount()| +|GetChartBackgroundColor()||public Color32 GetChartBackgroundColor()| +|GetChartComponent<T>()||public T GetChartComponent<T>(int index = 0) where T : MainComponent| +|GetChartComponentNum()||public int GetChartComponentNum(Type type)| +|GetChartComponentNum<T>()||public int GetChartComponentNum<T>() where T : MainComponent| +|GetChartComponents<T>()||public List<MainComponent> GetChartComponents<T>() where T : MainComponent| +|GetData()||public double GetData(int serieIndex, int dataIndex, int dimension = 1)| +|GetData()||public double GetData(string serieName, int dataIndex, int dimension = 1)| +|GetDataZoomOfAxis()||public DataZoom GetDataZoomOfAxis(Axis axis)| +|GetDataZoomOfSerie()||public void GetDataZoomOfSerie(Serie serie, out DataZoom xDataZoom, out DataZoom yDataZoom)| +|GetGrid()||public GridCoord GetGrid(Vector2 local)| +|GetGridOfDataZoom()||public GridCoord GetGridOfDataZoom(DataZoom dataZoom)| +|GetItemColor()||public Color32 GetItemColor(Serie serie)| +|GetItemColor()||public Color32 GetItemColor(Serie serie, SerieData serieData)| +|GetItemColor()||public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)| +|GetLegendRealShowNameColor()||public Color32 GetLegendRealShowNameColor(string name)| +|GetLegendRealShowNameIndex()||public int GetLegendRealShowNameIndex(string name)| +|GetMarkColor()||public Color32 GetMarkColor(Serie serie, SerieData serieData)
获得Serie的标识颜色。 | +|GetOrAddChartComponent<T>()||public T GetOrAddChartComponent<T>() where T : MainComponent| +|GetPainter()||public Painter GetPainter(int index)| +|GetSerie()||public Serie GetSerie(int serieIndex)| +|GetSerie()||public Serie GetSerie(string serieName)| +|GetSerie<T>()||public T GetSerie<T>() where T : Serie| +|GetSerie<T>()||public T GetSerie<T>(int serieIndex) where T : Serie| +|GetSerieBarGap<T>()||public float GetSerieBarGap<T>() where T : Serie| +|GetSerieBarRealCount<T>()||public int GetSerieBarRealCount<T>() where T : Serie| +|GetSerieIndexIfStack<T>()||public int GetSerieIndexIfStack<T>(Serie currSerie) where T : Serie| +|GetSerieSameStackTotalValue<T>()||public double GetSerieSameStackTotalValue<T>(string stack, int dataIndex) where T : Serie| +|GetSeriesMinMaxValue()||public virtual void GetSeriesMinMaxValue(Axis axis, int axisIndex, out double tempMinValue, out double tempMaxValue)| +|GetSerieTotalGap<T>()||public float GetSerieTotalGap<T>(float categoryWidth, float gap, int index) where T : Serie| +|GetSerieTotalWidth<T>()||public float GetSerieTotalWidth<T>(float categoryWidth, float gap, int realBarCount) where T : Serie| +|GetTitlePosition()||public Vector3 GetTitlePosition(Title title)| +|GetVisualMapOfSerie()||public VisualMap GetVisualMapOfSerie(Serie serie)| +|GetXDataZoomOfSerie()||public DataZoom GetXDataZoomOfSerie(Serie serie)| +|GetXLerpColor()||public Color32 GetXLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, GridCoord grid)| +|GetYLerpColor()||public Color32 GetYLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, GridCoord grid)| +|HasChartComponent()||public bool HasChartComponent(Type type)| +|HasChartComponent<T>()||public bool HasChartComponent<T>()| +|HasSerie()||public bool HasSerie(Type type)| +|HasSerie<T>()||public bool HasSerie<T>() where T : Serie| +|Init()||public void Init(bool defaultChart = true)| +|InitAxisRuntimeData()||public virtual void InitAxisRuntimeData(Axis axis) { }| +|InsertSerie()||public void InsertSerie(Serie serie, int index = -1, bool addToHead = false)| +|InsertSerie<T>()||public T InsertSerie<T>(int index, string serieName = null, bool show = true) where T : Serie| +|Internal_CheckAnimation()||public void Internal_CheckAnimation()| +|IsActiveByLegend()||public virtual bool IsActiveByLegend(string legendName)
Whether serie is activated. | +|IsAllAxisCategory()||public bool IsAllAxisCategory()
纯类目轴。 | +|IsAllAxisValue()||public bool IsAllAxisValue()
reutrn true when all the show axis is `Value` type. | +|IsInAnyGrid()||public bool IsInAnyGrid(Vector2 local)| +|IsInChart()||public bool IsInChart(float x, float y)| +|IsInChart()||public bool IsInChart(Vector2 local)
坐标是否在图表范围内 | +|IsSerieName()||public bool IsSerieName(string name)| +|MoveDownSerie()||public bool MoveDownSerie(int serieIndex)| +|MoveUpSerie()||public bool MoveUpSerie(int serieIndex)| +|OnAfterDeserialize()||public void OnAfterDeserialize()| +|OnBeforeSerialize()||public void OnBeforeSerialize()| +|OnBeginDrag()||public override void OnBeginDrag(PointerEventData eventData)| +|OnDataZoomRangeChanged()||public virtual void OnDataZoomRangeChanged(DataZoom dataZoom)| +|OnDrag()||public override void OnDrag(PointerEventData eventData)| +|OnEndDrag()||public override void OnEndDrag(PointerEventData eventData)| +|OnLegendButtonClick()||public virtual void OnLegendButtonClick(int index, string legendName, bool show)| +|OnLegendButtonEnter()||public virtual void OnLegendButtonEnter(int index, string legendName)| +|OnLegendButtonExit()||public virtual void OnLegendButtonExit(int index, string legendName)| +|OnPointerClick()||public override void OnPointerClick(PointerEventData eventData)| +|OnPointerDown()||public override void OnPointerDown(PointerEventData eventData)| +|OnPointerEnter()||public override void OnPointerEnter(PointerEventData eventData)| +|OnPointerExit()||public override void OnPointerExit(PointerEventData eventData)| +|OnPointerUp()||public override void OnPointerUp(PointerEventData eventData)| +|OnScroll()||public override void OnScroll(PointerEventData eventData)| +|RefreshBasePainter()||public void RefreshBasePainter()| +|RefreshChart()||public void RefreshChart()
Redraw chart in next frame. | +|RefreshChart()||public void RefreshChart(int serieIndex)
Redraw chart serie in next frame. | +|RefreshChart()||public void RefreshChart(Serie serie)
Redraw chart serie in next frame. | +|RefreshDataZoom()||public void RefreshDataZoom()
在下一帧刷新DataZoom | +|RefreshGraph()||public override void RefreshGraph()| +|RefreshPainter()||public void RefreshPainter(int index)| +|RefreshPainter()||public void RefreshPainter(Serie serie)| +|RefreshTopPainter()||public void RefreshTopPainter()| +|RefreshUpperPainter()||public void RefreshUpperPainter()| +|RemoveAllChartComponent()||public void RemoveAllChartComponent()| +|RemoveAllSerie()|v3.2.0|public virtual void RemoveAllSerie()
Remove all of them Serie. This interface is used when Serie needs to be removed only, and RemoveData() is generally used in other cases. | +|RemoveChartComponent()||public bool RemoveChartComponent(MainComponent component)| +|RemoveChartComponent()||public bool RemoveChartComponent(Type type, int index = 0)| +|RemoveChartComponent<T>()||public bool RemoveChartComponent<T>(int index = 0)| +|RemoveChartComponents()||public int RemoveChartComponents(Type type)| +|RemoveChartComponents<T>()||public int RemoveChartComponents<T>()| +|RemoveData()||public virtual void RemoveData()
Empty all component data and remove all series. Use the chart again and again to tell the truth. Note: The component only clears the data part, and the parameters are retained and not reset. | +|RemoveData()||public virtual void RemoveData(string serieName)
Remove legend and serie by name. | +|RemoveSerie()||public void RemoveSerie(int serieIndex)| +|RemoveSerie()||public void RemoveSerie(Serie serie)| +|RemoveSerie()||public void RemoveSerie(string serieName)| +|RemoveSerie<T>()||public void RemoveSerie<T>() where T : Serie| +|ReplaceSerie()||public bool ReplaceSerie(Serie oldSerie, Serie newSerie)| +|ResetDataIndex()||public bool ResetDataIndex(int serieIndex)
重置serie的数据项索引。避免数据项索引异常。 | +|SetBasePainterMaterial()||public void SetBasePainterMaterial(Material material)
设置Base Painter的材质球 | +|SetMaxCache()||public void SetMaxCache(int maxCache)
设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 | +|SetPainterActive()||public void SetPainterActive(int index, bool flag)| +|SetSerieActive()||public void SetSerieActive(int serieIndex, bool active)
Whether to show serie. | +|SetSerieActive()||public void SetSerieActive(Serie serie, bool active)| +|SetSerieActive()||public void SetSerieActive(string serieName, bool active)
Whether to show serie. | +|SetSeriePainterMaterial()||public void SetSeriePainterMaterial(Material material)
设置Serie Painter的材质球 | +|SetTopPainterMaterial()||public void SetTopPainterMaterial(Material material)
设置Top Painter的材质球 | +|SetUpperPainterMaterial()||public void SetUpperPainterMaterial(Material material)
设置Upper Painter的材质球 | +|TryAddChartComponent()||public bool TryAddChartComponent(Type type)| +|TryAddChartComponent<T>()||public bool TryAddChartComponent<T>() where T : MainComponent| +|TryAddChartComponent<T>()||public bool TryAddChartComponent<T>(out T component) where T : MainComponent| +|TryGetChartComponent<T>()||public bool TryGetChartComponent<T>(out T component, int index = 0)| +|UpdateData()||public bool UpdateData(int serieIndex, int dataIndex, double value)
Update serie data by serie index. | +|UpdateData()||public bool UpdateData(int serieIndex, int dataIndex, int dimension, double value)
更新指定系列指定索引指定维数的数据。维数从0开始。 | +|UpdateData()||public bool UpdateData(int serieIndex, int dataIndex, List<double> multidimensionalData)
更新指定系列指定索引的数据项的多维数据。 | +|UpdateData()||public bool UpdateData(string serieName, int dataIndex, double value)
Update serie data by serie name. | +|UpdateData()||public bool UpdateData(string serieName, int dataIndex, int dimension, double value)
更新指定系列指定索引指定维数的数据。维数从0开始。 | +|UpdateData()||public bool UpdateData(string serieName, int dataIndex, List<double> multidimensionalData)
更新指定系列指定索引的数据项的多维数据。 | +|UpdateDataName()||public bool UpdateDataName(int serieIndex, int dataIndex, string dataName)
Update serie data name. | +|UpdateDataName()||public bool UpdateDataName(string serieName, int dataIndex, string dataName)
Update serie data name. | +|UpdateLegendColor()||public virtual void UpdateLegendColor(string legendName, bool active)| +|UpdateTheme()||public bool UpdateTheme(ThemeType theme)
Update chart theme. | +|UpdateTheme()||public void UpdateTheme(Theme theme)
Update chart theme info. | +|UpdateXAxisData()||public void UpdateXAxisData(int index, string category, int xAxisIndex = 0)
Update category data. | +|UpdateXAxisIcon()||public void UpdateXAxisIcon(int index, Sprite icon, int xAxisIndex = 0)
Update xAxis icon. | +|UpdateYAxisData()||public void UpdateYAxisData(int index, string category, int yAxisIndex = 0)
Update category data. | +|UpdateYAxisIcon()||public void UpdateYAxisIcon(int index, Sprite icon, int yAxisIndex = 0)
更新Y轴图标。 | ## BaseGraph Inherits or Implemented: [MaskableGraphic](#maskablegraphic),[IPointerDownHandler](#ipointerdownhandler),[IPointerUpHandler](#ipointeruphandler),[](#) -|public method|description| -|--|--| -| CheckWarning() |public string CheckWarning()
检测警告信息。 | -| OnBeginDrag() |public virtual void OnBeginDrag(PointerEventData eventData)| -| OnDrag() |public virtual void OnDrag(PointerEventData eventData)| -| OnEndDrag() |public virtual void OnEndDrag(PointerEventData eventData)| -| OnPointerClick() |public virtual void OnPointerClick(PointerEventData eventData)| -| OnPointerDown() |public virtual void OnPointerDown(PointerEventData eventData)| -| OnPointerEnter() |public virtual void OnPointerEnter(PointerEventData eventData)| -| OnPointerExit() |public virtual void OnPointerExit(PointerEventData eventData)| -| OnPointerUp() |public virtual void OnPointerUp(PointerEventData eventData)| -| OnScroll() |public virtual void OnScroll(PointerEventData eventData)| -| RebuildChartObject() |public void RebuildChartObject()
移除并重新创建所有图表的Object。 | -| RefreshAllComponent() |public void RefreshAllComponent()| -| RefreshGraph() |public virtual void RefreshGraph()
Redraw graph in next frame. | -| ScreenPointToChartPoint() |public bool ScreenPointToChartPoint(Vector2 screenPoint, out Vector2 chartPoint)| -| SetPainterDirty() |public void SetPainterDirty()
重新初始化Painter | -| SetSize() |public virtual void SetSize(float width, float height)
设置图形的宽高(在非stretch pivot下才有效,其他情况需要自己调整RectTransform) | +|public method|since|description| +|--|--|--| +|onBeginDrag||public Action<PointerEventData, BaseGraph> onBeginDrag
鼠标开始拖拽回调。 | +|onDrag||public Action<PointerEventData, BaseGraph> onDrag
鼠标拖拽回调。 | +|onEndDrag||public Action<PointerEventData, BaseGraph> onEndDrag
鼠标结束拖拽回调。 | +|onPointerClick||public Action<PointerEventData, BaseGraph> onPointerClick
鼠标点击回调。 | +|onPointerDown||public Action<PointerEventData, BaseGraph> onPointerDown
鼠标按下回调。 | +|onPointerEnter||public Action<PointerEventData, BaseGraph> onPointerEnter
鼠标进入回调。 | +|onPointerExit||public Action<PointerEventData, BaseGraph> onPointerExit
鼠标退出回调。 | +|onPointerUp||public Action<PointerEventData, BaseGraph> onPointerUp
鼠标弹起回调。 | +|onScroll||public Action<PointerEventData, BaseGraph> onScroll
鼠标滚动回调。 | +|CheckWarning()||public string CheckWarning()
检测警告信息。 | +|OnBeginDrag()||public virtual void OnBeginDrag(PointerEventData eventData)| +|OnDrag()||public virtual void OnDrag(PointerEventData eventData)| +|OnEndDrag()||public virtual void OnEndDrag(PointerEventData eventData)| +|OnPointerClick()||public virtual void OnPointerClick(PointerEventData eventData)| +|OnPointerDown()||public virtual void OnPointerDown(PointerEventData eventData)| +|OnPointerEnter()||public virtual void OnPointerEnter(PointerEventData eventData)| +|OnPointerExit()||public virtual void OnPointerExit(PointerEventData eventData)| +|OnPointerUp()||public virtual void OnPointerUp(PointerEventData eventData)| +|OnScroll()||public virtual void OnScroll(PointerEventData eventData)| +|RebuildChartObject()||public void RebuildChartObject()
移除并重新创建所有图表的Object。 | +|RefreshAllComponent()||public void RefreshAllComponent()| +|RefreshGraph()||public virtual void RefreshGraph()
Redraw graph in next frame. | +|SaveAsImage()||public void SaveAsImage(string imageType = "png", string savePath = "")
保存图表为图片。 | +|ScreenPointToChartPoint()||public bool ScreenPointToChartPoint(Vector2 screenPoint, out Vector2 chartPoint)| +|SetPainterDirty()||public void SetPainterDirty()
重新初始化Painter | +|SetSize()||public virtual void SetSize(float width, float height)
设置图形的宽高(在非stretch pivot下才有效,其他情况需要自己调整RectTransform) | ## CandlestickChart @@ -287,14 +378,14 @@ Inherits or Implemented: [BaseChart](#basechart) ## ChartCached -|public method|description| -|--|--| -| ColorToDotStr() |public static string ColorToDotStr(Color color)| -| ColorToStr() |public static string ColorToStr(Color color)| -| FloatToStr() |public static string FloatToStr(double value, string numericFormatter = "F", int precision = 0)| -| GetSerieLabelName() |public static string GetSerieLabelName(string prefix, int i, int j)| -| IntToStr() |public static string IntToStr(int value, string numericFormatter = "")| -| NumberToStr() |public static string NumberToStr(double value, string formatter)| +|public method|since|description| +|--|--|--| +|ColorToDotStr()||public static string ColorToDotStr(Color color)| +|ColorToStr()||public static string ColorToStr(Color color)| +|FloatToStr()||public static string FloatToStr(double value, string numericFormatter = "F", int precision = 0)| +|GetSerieLabelName()||public static string GetSerieLabelName(string prefix, int i, int j)| +|IntToStr()||public static string IntToStr(int value, string numericFormatter = "")| +|NumberToStr()||public static string NumberToStr(double value, string formatter)| ## ChartConst @@ -302,144 +393,147 @@ Inherits or Implemented: [BaseChart](#basechart) ## ChartHelper -|public method|description| -|--|--| -| ActiveAllObject() |public static void ActiveAllObject(Transform parent, bool active, string match = null)| -| AddIcon() |public static Image AddIcon(string name, Transform parent, IconStyle iconStyle)| -| Cancat() |public static string Cancat(string str1, int i)| -| Cancat() |public static string Cancat(string str1, string str2)| -| ClearEventListener() |public static void ClearEventListener(GameObject obj)| -| CopyArray<T>() |public static bool CopyArray<T>(T[] toList, T[] fromList)| -| CopyList<T>() |public static bool CopyList<T>(List<T> toList, List<T> fromList)| -| DestoryGameObject() |public static void DestoryGameObject(GameObject go)| -| DestoryGameObject() |public static void DestoryGameObject(Transform parent, string childName)| -| DestoryGameObjectByMatch() |public static void DestoryGameObjectByMatch(Transform parent, string match)| -| DestroyAllChildren() |public static void DestroyAllChildren(Transform parent)| -| GetActualValue() |public static float GetActualValue(float valueOrRate, float total, float maxRate = 1.5f)| -| GetAngle360() |public static float GetAngle360(Vector2 from, Vector2 to)
获得0-360的角度(12点钟方向为0度) | -| GetBlurColor() |public static Color32 GetBlurColor(Color32 color, float a = 0.3f)| -| GetColor() |public static Color32 GetColor(string hexColorStr)| -| GetDire() |public static Vector3 GetDire(float angle, bool isDegree = false)| -| GetFloatAccuracy() |public static int GetFloatAccuracy(double value)| -| GetFullName() |public static string GetFullName(Transform transform)| -| GetHighlightColor() |public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)| -| GetLastValue() |public static Vector3 GetLastValue(List<Vector3> list)| -| GetMaxDivisibleValue() |public static double GetMaxDivisibleValue(double max, double ceilRate)| -| GetMaxLogValue() |public static double GetMaxLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)| -| GetMinDivisibleValue() |public static double GetMinDivisibleValue(double min, double ceilRate)| -| GetMinLogValue() |public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)| -| GetOrAddComponent<T>() |public static T GetOrAddComponent<T>(GameObject gameObject) where T : Component| -| GetOrAddComponent<T>() |public static T GetOrAddComponent<T>(Transform transform) where T : Component| -| GetPointList() |public static void GetPointList(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float k = 30f)| -| GetPos() |public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)| -| GetPosition() |public static Vector3 GetPosition(Vector3 center, float angle, float radius)| -| GetSelectColor() |public static Color32 GetSelectColor(Color32 color, float rate = 0.8f)| -| GetVertialDire() |public static Vector3 GetVertialDire(Vector3 dire)| -| HideAllObject() |public static void HideAllObject(GameObject obj, string match = null)| -| HideAllObject() |public static void HideAllObject(Transform parent, string match = null)| -| IsClearColor() |public static bool IsClearColor(Color color)| -| IsClearColor() |public static bool IsClearColor(Color32 color)| -| IsColorAlphaZero() |public static bool IsColorAlphaZero(Color color)| -| IsEquals() |public static bool IsEquals(double d1, double d2)| -| IsEquals() |public static bool IsEquals(float d1, float d2)| -| IsIngore() |public static bool IsIngore(Vector3 pos)| -| IsInRect() |public static bool IsInRect(Vector3 pos, float xMin, float xMax, float yMin, float yMax)| -| IsPointInQuadrilateral() |public static bool IsPointInQuadrilateral(Vector3 P, Vector3 A, Vector3 B, Vector3 C, Vector3 D)| -| IsValueEqualsColor() |public static bool IsValueEqualsColor(Color color1, Color color2)| -| IsValueEqualsColor() |public static bool IsValueEqualsColor(Color32 color1, Color32 color2)| -| IsValueEqualsList<T>() |public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)| -| IsValueEqualsString() |public static bool IsValueEqualsString(string str1, string str2)| -| IsValueEqualsVector2() |public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)| -| IsValueEqualsVector3() |public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)| -| IsZeroVector() |public static bool IsZeroVector(Vector3 pos)| -| ParseFloatFromString() |public static List<float> ParseFloatFromString(string jsonData)| -| ParseStringFromString() |public static List<string> ParseStringFromString(string jsonData)| -| RemoveComponent<T>() |public static void RemoveComponent<T>(GameObject gameObject)| -| RotateRound() |public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)| -| SaveAsImage() |public static Texture2D SaveAsImage(RectTransform rectTransform, Canvas canvas, string imageType = "png", string path = "")| -| SetActive() |public static void SetActive(GameObject gameObject, bool active)| -| SetActive() |public static void SetActive(Image image, bool active)| -| SetActive() |public static void SetActive(Text text, bool active)| -| SetActive() |public static void SetActive(Transform transform, bool active)
通过设置scale实现是否显示,优化性能,减少GC | -| SetBackground() |public static void SetBackground(Image background, ImageStyle imageStyle)| -| SetColorOpacity() |public static void SetColorOpacity(ref Color32 color, float opacity)| +|public method|since|description| +|--|--|--| +|ActiveAllObject()||public static void ActiveAllObject(Transform parent, bool active, string match = null)| +|AddIcon()||public static Image AddIcon(string name, Transform parent, IconStyle iconStyle)| +|Cancat()||public static string Cancat(string str1, int i)| +|Cancat()||public static string Cancat(string str1, string str2)| +|ClearEventListener()||public static void ClearEventListener(GameObject obj)| +|CopyArray<T>()||public static bool CopyArray<T>(T[] toList, T[] fromList)| +|CopyList<T>()||public static bool CopyList<T>(List<T> toList, List<T> fromList)| +|DestoryGameObject()||public static void DestoryGameObject(GameObject go)| +|DestoryGameObject()||public static void DestoryGameObject(Transform parent, string childName)| +|DestoryGameObjectByMatch()||public static void DestoryGameObjectByMatch(Transform parent, string containString)| +|DestroyAllChildren()||public static void DestroyAllChildren(Transform parent)| +|EnsureComponent<T>()||public static T EnsureComponent<T>(GameObject gameObject) where T : Component
Ensure that the game object has the specified component, add it if not. | +|EnsureComponent<T>()||public static T EnsureComponent<T>(Transform transform) where T : Component
Ensure that the transform has the specified component, add it if not. | +|GetActualValue()||public static float GetActualValue(float valueOrRate, float total, float maxRate = 1.5f)| +|GetAngle360()||public static float GetAngle360(Vector2 from, Vector2 to)
获得0-360的角度(12点钟方向为0度) | +|GetBlurColor()||public static Color32 GetBlurColor(Color32 color, float a = 0.3f)| +|GetColor()||public static Color32 GetColor(string hexColorStr)| +|GetDire()||public static Vector3 GetDire(float angle, bool isDegree = false)| +|GetFullName()||public static string GetFullName(Transform transform)| +|GetHighlightColor()||public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)| +|GetLastValue()||public static Vector3 GetLastValue(List<Vector3> list)| +|GetMaxDivisibleValue()||public static double GetMaxDivisibleValue(double max, double ceilRate)| +|GetMaxLogValue()||public static double GetMaxLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)| +|GetMinDivisibleValue()||public static double GetMinDivisibleValue(double min, double ceilRate)| +|GetMinLogValue()||public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)| +|GetOrAddComponent<T>()||public static T GetOrAddComponent<T>(GameObject gameObject) where T : Component| +|GetOrAddComponent<T>()||public static T GetOrAddComponent<T>(Transform transform) where T : Component| +|GetPointList()||public static void GetPointList(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float k = 30f)| +|GetPos()||public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)| +|GetPosition()||public static Vector3 GetPosition(Vector3 center, float angle, float radius)| +|GetSelectColor()||public static Color32 GetSelectColor(Color32 color, float rate = 0.8f)| +|GetVertialDire()||public static Vector3 GetVertialDire(Vector3 dire)| +|HideAllObject()||public static void HideAllObject(GameObject obj, string match = null)| +|HideAllObject()||public static void HideAllObject(Transform parent, string match = null)| +|IsClearColor()||public static bool IsClearColor(Color color)| +|IsClearColor()||public static bool IsClearColor(Color32 color)| +|IsColorAlphaZero()||public static bool IsColorAlphaZero(Color color)| +|IsEquals()||public static bool IsEquals(double d1, double d2)| +|IsEquals()||public static bool IsEquals(float d1, float d2)| +|IsIngore()||public static bool IsIngore(Vector3 pos)| +|IsInRect()||public static bool IsInRect(Vector3 pos, float xMin, float xMax, float yMin, float yMax)| +|IsPointInQuadrilateral()||public static bool IsPointInQuadrilateral(Vector3 P, Vector3 A, Vector3 B, Vector3 C, Vector3 D)| +|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color color1, Color color2)| +|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color32 color1, Color32 color2)| +|IsValueEqualsList<T>()||public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)| +|IsValueEqualsString()||public static bool IsValueEqualsString(string str1, string str2)| +|IsValueEqualsVector2()||public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)| +|IsValueEqualsVector3()||public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)| +|IsZeroVector()||public static bool IsZeroVector(Vector3 pos)| +|ParseFloatFromString()||public static List<float> ParseFloatFromString(string jsonData)| +|ParseStringFromString()||public static List<string> ParseStringFromString(string jsonData)| +|RemoveComponent<T>()||public static void RemoveComponent<T>(GameObject gameObject)| +|RotateRound()||public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)| +|SaveAsImage()||public static Texture2D SaveAsImage(RectTransform rectTransform, Canvas canvas, string imageType = "png", string path = "")| +|SetActive()||public static void SetActive(GameObject gameObject, bool active)| +|SetActive()||public static void SetActive(Image image, bool active)| +|SetActive()||public static void SetActive(Text text, bool active)| +|SetActive()||public static void SetActive(Transform transform, bool active)
通过设置scale实现是否显示,优化性能,减少GC | +|SetBackground()||public static void SetBackground(Image background, ImageStyle imageStyle)| +|SetColorOpacity()||public static void SetColorOpacity(ref Color32 color, float opacity)| ## ChartLabel Inherits or Implemented: [Image](#image) -|public method|description| -|--|--| -| GetHeight() |public float GetHeight()| -| GetPosition() |public Vector3 GetPosition()| -| GetTextHeight() |public float GetTextHeight()| -| GetTextWidth() |public float GetTextWidth()| -| GetWidth() |public float GetWidth()| -| SetActive() |public void SetActive(bool flag)| -| SetIcon() |public void SetIcon(Image image)| -| SetIconActive() |public void SetIconActive(bool flag)| -| SetIconSize() |public void SetIconSize(float width, float height)| -| SetIconSprite() |public void SetIconSprite(Sprite sprite)| -| SetPadding() |public void SetPadding(float[] padding)| -| SetPosition() |public void SetPosition(Vector3 position)| -| SetRectPosition() |public void SetRectPosition(Vector3 position)| -| SetSize() |public void SetSize(float width, float height)| -| SetText() |public bool SetText(string text)| -| SetTextActive() |public void SetTextActive(bool flag)| -| SetTextColor() |public void SetTextColor(Color color)| -| SetTextPadding() |public void SetTextPadding(TextPadding padding)| -| SetTextRotate() |public void SetTextRotate(float rotate)| -| UpdateIcon() |public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null)| +|public method|since|description| +|--|--|--| +|GetHeight()||public float GetHeight()| +|GetPosition()||public Vector3 GetPosition()| +|GetTextHeight()||public float GetTextHeight()| +|GetTextWidth()||public float GetTextWidth()| +|GetWidth()||public float GetWidth()| +|IsActive()||public override bool IsActive()| +|SetActive()||public void SetActive(bool flag)| +|SetIcon()||public void SetIcon(Image image)| +|SetIconActive()||public void SetIconActive(bool flag)| +|SetIconSize()||public void SetIconSize(float width, float height)| +|SetIconSprite()||public void SetIconSprite(Sprite sprite)| +|SetPadding()||public void SetPadding(float[] padding)| +|SetPosition()||public void SetPosition(Vector3 position)| +|SetRectPosition()||public void SetRectPosition(Vector3 position)| +|SetRotate()||public void SetRotate(float rotate)| +|SetSize()||public void SetSize(float width, float height)| +|SetText()||public bool SetText(string text)| +|SetTextActive()||public void SetTextActive(bool flag)| +|SetTextColor()||public void SetTextColor(Color color)| +|SetTextPadding()||public void SetTextPadding(TextPadding padding)| +|SetTextRotate()||public void SetTextRotate(float rotate)| +|UpdateIcon()||public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null)| ## ChartObject -|public method|description| -|--|--| -| Destroy() |public virtual void Destroy()| +|public method|since|description| +|--|--|--| +|Destroy()||public virtual void Destroy()| ## CheckHelper -|public method|description| -|--|--| -| CheckChart() |public static string CheckChart(BaseChart chart)| -| CheckChart() |public static string CheckChart(BaseGraph chart)| +|public method|since|description| +|--|--|--| +|CheckChart()||public static string CheckChart(BaseChart chart)| +|CheckChart()||public static string CheckChart(BaseGraph chart)| ## ColorUtil -|public method|description| -|--|--| -| GetColor() |public static Color32 GetColor(string hexColorStr)
Convert the html string to color. | +|public method|since|description| +|--|--|--| +|GetColor()||public static Color32 GetColor(string hexColorStr)
Convert the html string to color. | ## ComponentHandlerAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| ComponentHandlerAttribute() |public ComponentHandlerAttribute(Type handler)| -| ComponentHandlerAttribute() |public ComponentHandlerAttribute(Type handler, bool allowMultiple)| +|public method|since|description| +|--|--|--| +|ComponentHandlerAttribute()||public ComponentHandlerAttribute(Type handler)| +|ComponentHandlerAttribute()||public ComponentHandlerAttribute(Type handler, bool allowMultiple)| ## ComponentHelper -|public method|description| -|--|--| -| GetAngleAxis() |public static AngleAxis GetAngleAxis(List<MainComponent> components, int polarIndex)| -| GetRadiusAxis() |public static RadiusAxis GetRadiusAxis(List<MainComponent> components, int polarIndex)| -| GetXAxisOnZeroOffset() |public static float GetXAxisOnZeroOffset(List<MainComponent> components, XAxis axis)| -| GetYAxisOnZeroOffset() |public static float GetYAxisOnZeroOffset(List<MainComponent> components, YAxis axis)| -| IsAnyCategoryOfYAxis() |public static bool IsAnyCategoryOfYAxis(List<MainComponent> components)| +|public method|since|description| +|--|--|--| +|GetAngleAxis()||public static AngleAxis GetAngleAxis(List<MainComponent> components, int polarIndex)| +|GetRadiusAxis()||public static RadiusAxis GetRadiusAxis(List<MainComponent> components, int polarIndex)| +|GetXAxisOnZeroOffset()||public static float GetXAxisOnZeroOffset(List<MainComponent> components, XAxis axis)| +|GetYAxisOnZeroOffset()||public static float GetYAxisOnZeroOffset(List<MainComponent> components, YAxis axis)| +|IsAnyCategoryOfYAxis()||public static bool IsAnyCategoryOfYAxis(List<MainComponent> components)| ## CoordOptionsAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Contains<T>() |public bool Contains<T>() where T : CoordSystem| -| CoordOptionsAttribute() |public CoordOptionsAttribute(Type coord)| -| CoordOptionsAttribute() |public CoordOptionsAttribute(Type coord, Type coord2)| -| CoordOptionsAttribute() |public CoordOptionsAttribute(Type coord, Type coord2, Type coord3)| -| CoordOptionsAttribute() |public CoordOptionsAttribute(Type coord, Type coord2, Type coord3, Type coord4)| +|public method|since|description| +|--|--|--| +|Contains<T>()||public bool Contains<T>() where T : CoordSystem| +|CoordOptionsAttribute()||public CoordOptionsAttribute(Type coord)| +|CoordOptionsAttribute()||public CoordOptionsAttribute(Type coord, Type coord2)| +|CoordOptionsAttribute()||public CoordOptionsAttribute(Type coord, Type coord2, Type coord3)| +|CoordOptionsAttribute()||public CoordOptionsAttribute(Type coord, Type coord2, Type coord3, Type coord4)| ## DataZoomContext @@ -447,43 +541,43 @@ Inherits or Implemented: [MainComponentContext](#maincomponentcontext) ## DataZoomHelper -|public method|description| -|--|--| -| UpdateDataZoomRuntimeStartEndValue() |public static void UpdateDataZoomRuntimeStartEndValue(DataZoom dataZoom, Serie serie)| -| UpdateDataZoomRuntimeStartEndValue<T>() |public static void UpdateDataZoomRuntimeStartEndValue<T>(BaseChart chart) where T : Serie| +|public method|since|description| +|--|--|--| +|UpdateDataZoomRuntimeStartEndValue()||public static void UpdateDataZoomRuntimeStartEndValue(DataZoom dataZoom, Serie serie)| +|UpdateDataZoomRuntimeStartEndValue<T>()||public static void UpdateDataZoomRuntimeStartEndValue<T>(BaseChart chart) where T : Serie| ## DateTimeUtil -|public method|description| -|--|--| -| GetDateTime() |public static DateTime GetDateTime(int timestamp)| -| GetTimestamp() |public static int GetTimestamp()| -| GetTimestamp() |public static int GetTimestamp(DateTime time)| +|public method|since|description| +|--|--|--| +|GetDateTime()||public static DateTime GetDateTime(int timestamp)| +|GetTimestamp()||public static int GetTimestamp()| +|GetTimestamp()||public static int GetTimestamp(DateTime time)| ## DefaultAnimationAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| DefaultAnimationAttribute() |public DefaultAnimationAttribute(AnimationType handler)| +|public method|since|description| +|--|--|--| +|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler)| ## DefineSymbolsUtil -|public method|description| -|--|--| -| AddGlobalDefine() |public static void AddGlobalDefine(string symbol)| -| RemoveGlobalDefine() |public static void RemoveGlobalDefine(string symbol)| +|public method|since|description| +|--|--|--| +|AddGlobalDefine()||public static void AddGlobalDefine(string symbol)| +|RemoveGlobalDefine()||public static void RemoveGlobalDefine(string symbol)| ## FormatterHelper -|public method|description| -|--|--| -| NeedFormat() |public static bool NeedFormat(string content)| -| ReplaceAxisLabelContent() |public static void ReplaceAxisLabelContent(ref string content, string numericFormatter, double value)| -| ReplaceAxisLabelContent() |public static void ReplaceAxisLabelContent(ref string content, string value)| -| TrimAndReplaceLine() |public static string TrimAndReplaceLine(string content)| -| TrimAndReplaceLine() |public static string TrimAndReplaceLine(StringBuilder sb)| +|public method|since|description| +|--|--|--| +|NeedFormat()||public static bool NeedFormat(string content)| +|ReplaceAxisLabelContent()||public static void ReplaceAxisLabelContent(ref string content, string numericFormatter, double value)| +|ReplaceAxisLabelContent()||public static void ReplaceAxisLabelContent(ref string content, string value)| +|TrimAndReplaceLine()||public static string TrimAndReplaceLine(string content)| +|TrimAndReplaceLine()||public static string TrimAndReplaceLine(StringBuilder sb)| ## GridCoordContext @@ -497,32 +591,39 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| IgnoreDoc() |public IgnoreDoc()| +|public method|since|description| +|--|--|--| +|IgnoreDoc()||public IgnoreDoc()| + +## InputHelper + +|public method|since|description| +|--|--|--| +|GetKeyDown()||public static bool GetKeyDown(KeyCode keyCode)| +|GetTouch()||public static Touch GetTouch(int v)| ## InteractData -|public method|description| -|--|--| -| Reset() |public void Reset()| -| SetColor() |public void SetColor(ref bool needInteract, Color32 color)| -| SetColor() |public void SetColor(ref bool needInteract, Color32 color, Color32 toColor)| -| SetValue() |public void SetValue(ref bool needInteract, float size)| -| SetValue() |public void SetValue(ref bool needInteract, float size, bool highlight, float rate = 1.3f)| -| SetValueAndColor() |public void SetValueAndColor(ref bool needInteract, float value, Color32 color)| -| SetValueAndColor() |public void SetValueAndColor(ref bool needInteract, float value, Color32 color, Color32 toColor)| -| TryGetColor() |public bool TryGetColor(ref Color32 color, ref bool interacting, float animationDuration = 250)| -| TryGetColor() |public bool TryGetColor(ref Color32 color, ref Color32 toColor, ref bool interacting, float animationDuration = 250)| -| TryGetValue() |public bool TryGetValue(ref float value, ref bool interacting, float animationDuration = 250)| -| TryGetValueAndColor() |public bool TryGetValueAndColor(ref float value, ref Color32 color, ref Color32 toColor, ref bool interacting, float animationDuration = 250)| +|public method|since|description| +|--|--|--| +|Reset()||public void Reset()| +|SetColor()||public void SetColor(ref bool needInteract, Color32 color)| +|SetColor()||public void SetColor(ref bool needInteract, Color32 color, Color32 toColor)| +|SetValue()||public void SetValue(ref bool needInteract, float size)| +|SetValue()||public void SetValue(ref bool needInteract, float size, bool highlight, float rate = 1.3f)| +|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color)| +|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color, Color32 toColor)| +|TryGetColor()||public bool TryGetColor(ref Color32 color, ref bool interacting, float animationDuration = 250)| +|TryGetColor()||public bool TryGetColor(ref Color32 color, ref Color32 toColor, ref bool interacting, float animationDuration = 250)| +|TryGetValue()||public bool TryGetValue(ref float value, ref bool interacting, float animationDuration = 250)| +|TryGetValueAndColor()||public bool TryGetValueAndColor(ref float value, ref Color32 color, ref Color32 toColor, ref bool interacting, float animationDuration = 250)| ## LayerHelper -|public method|description| -|--|--| -| IsFixedWidthHeight() |public static bool IsFixedWidthHeight(RectTransform rt)| -| IsStretchPivot() |public static bool IsStretchPivot(RectTransform rt)| +|public method|since|description| +|--|--|--| +|IsFixedWidthHeight()||public static bool IsFixedWidthHeight(RectTransform rt)| +|IsStretchPivot()||public static bool IsStretchPivot(RectTransform rt)| ## LegendContext @@ -530,37 +631,37 @@ Inherits or Implemented: [MainComponentContext](#maincomponentcontext) ## LegendHelper -|public method|description| -|--|--| -| CheckDataHighlighted() |public static bool CheckDataHighlighted(Serie serie, string legendName, bool heighlight)| -| CheckDataShow() |public static bool CheckDataShow(Serie serie, string legendName, bool show)| -| GetContentColor() |public static Color GetContentColor(BaseChart chart, int legendIndex, string legendName, Legend legend, ThemeStyle theme, bool active)| -| GetIconColor() |public static Color GetIconColor(BaseChart chart, Legend legend, int readIndex, string legendName, bool active)| -| ResetItemPosition() |public static void ResetItemPosition(Legend legend, Vector3 chartPos, float chartWidth, float chartHeight)| -| SetLegendBackground() |public static void SetLegendBackground(Legend legend, ImageStyle style)| +|public method|since|description| +|--|--|--| +|CheckDataHighlighted()||public static bool CheckDataHighlighted(Serie serie, string legendName, bool heighlight)| +|CheckDataShow()||public static bool CheckDataShow(Serie serie, string legendName, bool show)| +|GetContentColor()||public static Color GetContentColor(BaseChart chart, int legendIndex, string legendName, Legend legend, ThemeStyle theme, bool active)| +|GetIconColor()||public static Color GetIconColor(BaseChart chart, Legend legend, int readIndex, string legendName, bool active)| +|ResetItemPosition()||public static void ResetItemPosition(Legend legend, Vector3 chartPos, float chartWidth, float chartHeight)| +|SetLegendBackground()||public static void SetLegendBackground(Legend legend, ImageStyle style)| ## LegendItem -|public method|description| -|--|--| -| GetIconColor() |public Color GetIconColor()| -| GetIconRect() |public Rect GetIconRect()| -| SetActive() |public void SetActive(bool active)| -| SetBackground() |public void SetBackground(ImageStyle imageStyle)| -| SetButton() |public void SetButton(Button button)| -| SetContent() |public bool SetContent(string content)| -| SetContentBackgroundColor() |public void SetContentBackgroundColor(Color color)| -| SetContentColor() |public void SetContentColor(Color color)| -| SetContentPosition() |public void SetContentPosition(Vector3 offset)| -| SetIcon() |public void SetIcon(Image icon)| -| SetIconActive() |public void SetIconActive(bool active)| -| SetIconColor() |public void SetIconColor(Color color)| -| SetIconImage() |public void SetIconImage(Sprite image)| -| SetIconSize() |public void SetIconSize(float width, float height)| -| SetObject() |public void SetObject(GameObject obj)| -| SetPosition() |public void SetPosition(Vector3 position)| -| SetText() |public void SetText(ChartText text)| -| SetTextBackground() |public void SetTextBackground(Image image)| +|public method|since|description| +|--|--|--| +|GetIconColor()||public Color GetIconColor()| +|GetIconRect()||public Rect GetIconRect()| +|SetActive()||public void SetActive(bool active)| +|SetBackground()||public void SetBackground(ImageStyle imageStyle)| +|SetButton()||public void SetButton(Button button)| +|SetContent()||public bool SetContent(string content)| +|SetContentBackgroundColor()||public void SetContentBackgroundColor(Color color)| +|SetContentColor()||public void SetContentColor(Color color)| +|SetContentPosition()||public void SetContentPosition(Vector3 offset)| +|SetIcon()||public void SetIcon(Image icon)| +|SetIconActive()||public void SetIconActive(bool active)| +|SetIconColor()||public void SetIconColor(Color color)| +|SetIconImage()||public void SetIconImage(Sprite image)| +|SetIconSize()||public void SetIconSize(float width, float height)| +|SetObject()||public void SetObject(GameObject obj)| +|SetPosition()||public void SetPosition(Vector3 position)| +|SetText()||public void SetText(ChartText text)| +|SetTextBackground()||public void SetTextBackground(Image image)| ## LineChart @@ -570,49 +671,49 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| ListFor() |public ListFor(Type type)| +|public method|since|description| +|--|--|--| +|ListFor()||public ListFor(Type type)| ## ListForComponent Inherits or Implemented: [ListFor](#listfor) -|public method|description| -|--|--| -| ListForComponent() |public ListForComponent(Type type) : base(type)| +|public method|since|description| +|--|--|--| +|ListForComponent()||public ListForComponent(Type type) : base(type)| ## ListForSerie Inherits or Implemented: [ListFor](#listfor) -|public method|description| -|--|--| -| ListForSerie() |public ListForSerie(Type type) : base(type)| +|public method|since|description| +|--|--|--| +|ListForSerie()||public ListForSerie(Type type) : base(type)| ## MainComponentContext ## MainComponentHandler -|public method|description| -|--|--| -| CheckComponent() |public virtual void CheckComponent(StringBuilder sb) { }| -| DrawBase() |public virtual void DrawBase(VertexHelper vh) { }| -| DrawTop() |public virtual void DrawTop(VertexHelper vh) { }| -| DrawUpper() |public virtual void DrawUpper(VertexHelper vh) { }| -| InitComponent() |public virtual void InitComponent() { }| -| OnBeginDrag() |public virtual void OnBeginDrag(PointerEventData eventData) { }| -| OnDrag() |public virtual void OnDrag(PointerEventData eventData) { }| -| OnEndDrag() |public virtual void OnEndDrag(PointerEventData eventData) { }| -| OnPointerClick() |public virtual void OnPointerClick(PointerEventData eventData) { }| -| OnPointerDown() |public virtual void OnPointerDown(PointerEventData eventData) { }| -| OnPointerEnter() |public virtual void OnPointerEnter(PointerEventData eventData) { }| -| OnPointerExit() |public virtual void OnPointerExit(PointerEventData eventData) { }| -| OnPointerUp() |public virtual void OnPointerUp(PointerEventData eventData) { }| -| OnScroll() |public virtual void OnScroll(PointerEventData eventData) { }| -| OnSerieDataUpdate() |public virtual void OnSerieDataUpdate(int serieIndex) { }| -| RemoveComponent() |public virtual void RemoveComponent() { }| -| Update() |public virtual void Update() { }| +|public method|since|description| +|--|--|--| +|CheckComponent()||public virtual void CheckComponent(StringBuilder sb) { }| +|DrawBase()||public virtual void DrawBase(VertexHelper vh) { }| +|DrawTop()||public virtual void DrawTop(VertexHelper vh) { }| +|DrawUpper()||public virtual void DrawUpper(VertexHelper vh) { }| +|InitComponent()||public virtual void InitComponent() { }| +|OnBeginDrag()||public virtual void OnBeginDrag(PointerEventData eventData) { }| +|OnDrag()||public virtual void OnDrag(PointerEventData eventData) { }| +|OnEndDrag()||public virtual void OnEndDrag(PointerEventData eventData) { }| +|OnPointerClick()||public virtual void OnPointerClick(PointerEventData eventData) { }| +|OnPointerDown()||public virtual void OnPointerDown(PointerEventData eventData) { }| +|OnPointerEnter()||public virtual void OnPointerEnter(PointerEventData eventData) { }| +|OnPointerExit()||public virtual void OnPointerExit(PointerEventData eventData) { }| +|OnPointerUp()||public virtual void OnPointerUp(PointerEventData eventData) { }| +|OnScroll()||public virtual void OnScroll(PointerEventData eventData) { }| +|OnSerieDataUpdate()||public virtual void OnSerieDataUpdate(int serieIndex) { }| +|RemoveComponent()||public virtual void RemoveComponent() { }| +|Update()||public virtual void Update() { }| ## MainComponentHandler<T> @@ -620,35 +721,39 @@ Inherits or Implemented: [MainComponentHandler](#maincomponenthandler) ## MathUtil -|public method|description| -|--|--| -| Abs() |public static double Abs(double d)| -| Approximately() |public static bool Approximately(double a, double b)| -| Clamp() |public static double Clamp(double d, double min, double max)| -| Clamp01() |public static double Clamp01(double value)| -| Lerp() |public static double Lerp(double a, double b, double t)| +|public method|since|description| +|--|--|--| +|Abs()||public static double Abs(double d)| +|Approximately()||public static bool Approximately(double a, double b)| +|Clamp()||public static double Clamp(double d, double min, double max)| +|Clamp01()||public static double Clamp01(double value)| +|GetPrecision()||public static int GetPrecision(double value)| +|IsInteger()||public static bool IsInteger(double value)| +|Lerp()||public static double Lerp(double a, double b, double t)| ## ObjectPool<T> where T Inherits or Implemented: [new()](#new()) -|public method|description| -|--|--| -| ClearAll() |public void ClearAll()| -| Get() |public T Get()| -| new() |public class ObjectPool<T> where T : new()| -| ObjectPool() |public ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease, bool newIfEmpty = true)| -| Release() |public void Release(T element)| +|public method|since|description| +|--|--|--| +|ClearAll()||public void ClearAll()| +|Get()||public T Get()| +|new()||public class ObjectPool<T> where T : new()| +|ObjectPool()||public ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease, bool newIfEmpty = true)| +|Release()||public void Release(T element)| ## Painter Inherits or Implemented: [MaskableGraphic](#maskablegraphic) -|public method|description| -|--|--| -| Init() |public void Init()| -| Refresh() |public void Refresh()| -| SetActive() |public void SetActive(bool flag, bool isDebugMode = false)| +|public method|since|description| +|--|--|--| +|onPopulateMesh||public Action<VertexHelper, Painter> onPopulateMesh| +|CheckRefresh()||public void CheckRefresh()| +|Init()||public void Init()| +|Refresh()||public void Refresh()| +|SetActive()||public void SetActive(bool flag, bool isDebugMode = false)| ## ParallelChart @@ -670,18 +775,14 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [MainComponentContext](#maincomponentcontext) -## ProgressBar - -Inherits or Implemented: [BaseChart](#basechart) - ## PropertyUtil -|public method|description| -|--|--| -| SetClass<T>() |public static bool SetClass<T>(ref T currentValue, T newValue, bool notNull = false) where T : class| -| SetColor() |public static bool SetColor(ref Color currentValue, Color newValue)| -| SetColor() |public static bool SetColor(ref Color32 currentValue, Color32 newValue)| -| SetStruct<T>() |public static bool SetStruct<T>(ref T currentValue, T newValue) where T : struct| +|public method|since|description| +|--|--|--| +|SetClass<T>()||public static bool SetClass<T>(ref T currentValue, T newValue, bool notNull = false) where T : class| +|SetColor()||public static bool SetColor(ref Color currentValue, Color newValue)| +|SetColor()||public static bool SetColor(ref Color32 currentValue, Color32 newValue)| +|SetStruct<T>()||public static bool SetStruct<T>(ref T currentValue, T newValue) where T : struct| ## RadarChart @@ -693,24 +794,24 @@ Inherits or Implemented: [MainComponentContext](#maincomponentcontext) ## ReflectionUtil -|public method|description| -|--|--| -| DeepCloneSerializeField() |public static object DeepCloneSerializeField(object obj)| -| InvokeListAdd() |public static void InvokeListAdd(object obj, FieldInfo field, object item)| -| InvokeListAddTo<T>() |public static void InvokeListAddTo<T>(object obj, FieldInfo field, Action<T> callback)| -| InvokeListClear() |public static void InvokeListClear(object obj, FieldInfo field)| -| InvokeListCount() |public static int InvokeListCount(object obj, FieldInfo field)| -| InvokeListGet<T>() |public static T InvokeListGet<T>(object obj, FieldInfo field, int i)| +|public method|since|description| +|--|--|--| +|DeepCloneSerializeField()||public static object DeepCloneSerializeField(object obj)| +|InvokeListAdd()||public static void InvokeListAdd(object obj, FieldInfo field, object item)| +|InvokeListAddTo<T>()||public static void InvokeListAddTo<T>(object obj, FieldInfo field, Action<T> callback)| +|InvokeListClear()||public static void InvokeListClear(object obj, FieldInfo field)| +|InvokeListCount()||public static int InvokeListCount(object obj, FieldInfo field)| +|InvokeListGet<T>()||public static T InvokeListGet<T>(object obj, FieldInfo field, int i)| ## RequireChartComponentAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| RequireChartComponentAttribute() |public RequireChartComponentAttribute(Type requiredComponent)| -| RequireChartComponentAttribute() |public RequireChartComponentAttribute(Type requiredComponent, Type requiredComponent2)| -| RequireChartComponentAttribute() |public RequireChartComponentAttribute(Type requiredComponent, Type requiredComponent2, Type requiredComponent3)| +|public method|since|description| +|--|--|--| +|RequireChartComponentAttribute()||public RequireChartComponentAttribute(Type requiredComponent)| +|RequireChartComponentAttribute()||public RequireChartComponentAttribute(Type requiredComponent, Type requiredComponent2)| +|RequireChartComponentAttribute()||public RequireChartComponentAttribute(Type requiredComponent, Type requiredComponent2, Type requiredComponent3)| ## RingChart @@ -718,227 +819,245 @@ Inherits or Implemented: [BaseChart](#basechart) ## RuntimeUtil -|public method|description| -|--|--| -| GetAllAssemblyTypes() |public static IEnumerable<Type> GetAllAssemblyTypes()| -| GetAllTypesDerivedFrom() |public static IEnumerable<Type> GetAllTypesDerivedFrom(Type type)| -| GetAllTypesDerivedFrom<T>() |public static IEnumerable<Type> GetAllTypesDerivedFrom<T>()| -| GetAttribute<T>() |public static T GetAttribute<T>(this MemberInfo type, bool check = true) where T : Attribute| -| GetAttribute<T>() |public static T GetAttribute<T>(this Type type, bool check = true) where T : Attribute| -| HasSubclass() |public static bool HasSubclass(Type type)| +|public method|since|description| +|--|--|--| +|GetAllAssemblyTypes()||public static IEnumerable<Type> GetAllAssemblyTypes()| +|GetAllTypesDerivedFrom()||public static IEnumerable<Type> GetAllTypesDerivedFrom(Type type)| +|GetAllTypesDerivedFrom<T>()||public static IEnumerable<Type> GetAllTypesDerivedFrom<T>()| +|GetAttribute<T>()||public static T GetAttribute<T>(this MemberInfo type, bool check = true) where T : Attribute| +|GetAttribute<T>()||public static T GetAttribute<T>(this Type type, bool check = true) where T : Attribute| +|HasSubclass()||public static bool HasSubclass(Type type)| ## ScatterChart Inherits or Implemented: [BaseChart](#basechart) +## SerieComponentAttribute + +Inherits or Implemented: [Attribute](#attribute) + +|public method|since|description| +|--|--|--| +|Contains()||public bool Contains(Type type)| +|Contains<T>()||public bool Contains<T>() where T : ISerieComponent| +|SerieComponentAttribute()||public SerieComponentAttribute()| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)| + ## SerieContext ## SerieConvertAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Contains() |public bool Contains(Type type)| -| Contains<T>() |public bool Contains<T>() where T : Serie| -| SerieConvertAttribute() |public SerieConvertAttribute(Type serie)| -| SerieConvertAttribute() |public SerieConvertAttribute(Type serie, Type serie2)| -| SerieConvertAttribute() |public SerieConvertAttribute(Type serie, Type serie2, Type serie3)| -| SerieConvertAttribute() |public SerieConvertAttribute(Type serie, Type serie2, Type serie3, Type serie4)| +|public method|since|description| +|--|--|--| +|Contains()||public bool Contains(Type type)| +|Contains<T>()||public bool Contains<T>() where T : Serie| +|SerieConvertAttribute()||public SerieConvertAttribute(Type serie)| +|SerieConvertAttribute()||public SerieConvertAttribute(Type serie, Type serie2)| +|SerieConvertAttribute()||public SerieConvertAttribute(Type serie, Type serie2, Type serie3)| +|SerieConvertAttribute()||public SerieConvertAttribute(Type serie, Type serie2, Type serie3, Type serie4)| -## SerieDataContext - -|public method|description| -|--|--| -| Reset() |public void Reset()| - -## SerieDataExtraComponentAttribute +## SerieDataComponentAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Contains() |public bool Contains(Type type)| -| Contains<T>() |public bool Contains<T>() where T : ISerieExtraComponent| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute()| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)| +|public method|since|description| +|--|--|--| +|Contains()||public bool Contains(Type type)| +|Contains<T>()||public bool Contains<T>() where T : ISerieComponent| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute()| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)| + +## SerieDataContext + +|public method|since|description| +|--|--|--| +|Reset()||public void Reset()| ## SerieDataExtraFieldAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Contains() |public bool Contains(string field)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute()| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6, string field7)| +|public method|since|description| +|--|--|--| +|Contains()||public bool Contains(string field)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute()| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6, string field7)| -## SerieExtraComponentAttribute +## SerieEventData -Inherits or Implemented: [Attribute](#attribute) +|public method|since|description| +|--|--|--| +|Reset()||public void Reset()| -|public method|description| -|--|--| -| Contains() |public bool Contains(Type type)| -| Contains<T>() |public bool Contains<T>() where T : ISerieExtraComponent| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute()| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)| +## SerieEventDataPool + +|public method|since|description| +|--|--|--| +|Get()||public static SerieEventData Get(Vector3 pos, int serieIndex, int dataIndex, int dimension, double value)| +|Release()||public static void Release(SerieEventData toRelease)| ## SerieHandler -|public method|description| -|--|--| -| CheckComponent() |public virtual void CheckComponent(StringBuilder sb) { }| -| DrawBase() |public virtual void DrawBase(VertexHelper vh) { }| -| DrawSerie() |public virtual void DrawSerie(VertexHelper vh) { }| -| DrawTop() |public virtual void DrawTop(VertexHelper vh) { }| -| DrawUpper() |public virtual void DrawUpper(VertexHelper vh) { }| -| InitComponent() |public virtual void InitComponent() { }| -| OnBeginDrag() |public virtual void OnBeginDrag(PointerEventData eventData) { }| -| OnDrag() |public virtual void OnDrag(PointerEventData eventData) { }| -| OnEndDrag() |public virtual void OnEndDrag(PointerEventData eventData) { }| -| OnLegendButtonClick() |public virtual void OnLegendButtonClick(int index, string legendName, bool show) { }| -| OnLegendButtonEnter() |public virtual void OnLegendButtonEnter(int index, string legendName) { }| -| OnLegendButtonExit() |public virtual void OnLegendButtonExit(int index, string legendName) { }| -| OnPointerClick() |public virtual void OnPointerClick(PointerEventData eventData) { }| -| OnPointerDown() |public virtual void OnPointerDown(PointerEventData eventData) { }| -| OnPointerEnter() |public virtual void OnPointerEnter(PointerEventData eventData) { }| -| OnPointerExit() |public virtual void OnPointerExit(PointerEventData eventData) { }| -| OnPointerUp() |public virtual void OnPointerUp(PointerEventData eventData) { }| -| OnScroll() |public virtual void OnScroll(PointerEventData eventData) { }| -| RefreshLabelInternal() |public virtual void RefreshLabelInternal() { }| -| RefreshLabelNextFrame() |public virtual void RefreshLabelNextFrame() { }| -| RemoveComponent() |public virtual void RemoveComponent() { }| -| Update() |public virtual void Update() { }| +|public method|since|description| +|--|--|--| +|CheckComponent()||public virtual void CheckComponent(StringBuilder sb) { }| +|DrawBase()||public virtual void DrawBase(VertexHelper vh) { }| +|DrawSerie()||public virtual void DrawSerie(VertexHelper vh) { }| +|DrawTop()||public virtual void DrawTop(VertexHelper vh) { }| +|DrawUpper()||public virtual void DrawUpper(VertexHelper vh) { }| +|InitComponent()||public virtual void InitComponent() { }| +|OnBeginDrag()||public virtual void OnBeginDrag(PointerEventData eventData) { }| +|OnDrag()||public virtual void OnDrag(PointerEventData eventData) { }| +|OnEndDrag()||public virtual void OnEndDrag(PointerEventData eventData) { }| +|OnLegendButtonClick()||public virtual void OnLegendButtonClick(int index, string legendName, bool show) { }| +|OnLegendButtonEnter()||public virtual void OnLegendButtonEnter(int index, string legendName) { }| +|OnLegendButtonExit()||public virtual void OnLegendButtonExit(int index, string legendName) { }| +|OnPointerClick()||public virtual void OnPointerClick(PointerEventData eventData) { }| +|OnPointerDown()||public virtual void OnPointerDown(PointerEventData eventData) { }| +|OnPointerEnter()||public virtual void OnPointerEnter(PointerEventData eventData) { }| +|OnPointerExit()||public virtual void OnPointerExit(PointerEventData eventData) { }| +|OnPointerUp()||public virtual void OnPointerUp(PointerEventData eventData) { }| +|OnScroll()||public virtual void OnScroll(PointerEventData eventData) { }| +|RefreshLabelInternal()||public virtual void RefreshLabelInternal() { }| +|RefreshLabelNextFrame()||public virtual void RefreshLabelNextFrame() { }| +|RemoveComponent()||public virtual void RemoveComponent() { }| +|Update()||public virtual void Update() { }| +|UpdateSerieContext()||public virtual void UpdateSerieContext() { }| ## SerieHandler<T> Inherits or Implemented: [SerieHandler where T](#seriehandler where t),[Serie](#serie) -|public method|description| -|--|--| -| DrawLabelLineSymbol() |public void DrawLabelLineSymbol(VertexHelper vh, LabelLine labelLine, Vector3 startPos, Vector3 endPos, Color32 defaultColor)| -| GetSerieDataAutoColor() |public virtual Color GetSerieDataAutoColor(SerieData serieData)| -| GetSerieDataLabelOffset() |public virtual Vector3 GetSerieDataLabelOffset(SerieData serieData, LabelStyle label)| -| GetSerieDataLabelPosition() |public virtual Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label)| -| GetSerieDataTitlePosition() |public virtual Vector3 GetSerieDataTitlePosition(SerieData serieData, TitleStyle titleStyle)| -| InitComponent() |public override void InitComponent()| -| OnLegendButtonClick() |public override void OnLegendButtonClick(int index, string legendName, bool show)| -| OnLegendButtonEnter() |public override void OnLegendButtonEnter(int index, string legendName)| -| OnLegendButtonExit() |public override void OnLegendButtonExit(int index, string legendName)| -| RefreshEndLabelInternal() |public virtual void RefreshEndLabelInternal()| -| RefreshLabelInternal() |public override void RefreshLabelInternal()| -| RefreshLabelNextFrame() |public override void RefreshLabelNextFrame()| -| RemoveComponent() |public override void RemoveComponent()| -| Update() |public override void Update()| +|public method|since|description| +|--|--|--| +|DrawLabelLineSymbol()||public void DrawLabelLineSymbol(VertexHelper vh, LabelLine labelLine, Vector3 startPos, Vector3 endPos, Color32 defaultColor)| +|GetPointerItemDataDimension()||public override int GetPointerItemDataDimension()| +|GetPointerItemDataIndex()||public override int GetPointerItemDataIndex()| +|GetSerieDataAutoColor()||public virtual Color GetSerieDataAutoColor(SerieData serieData)| +|GetSerieDataLabelOffset()||public virtual Vector3 GetSerieDataLabelOffset(SerieData serieData, LabelStyle label)| +|GetSerieDataLabelPosition()||public virtual Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label)| +|GetSerieDataTitlePosition()||public virtual Vector3 GetSerieDataTitlePosition(SerieData serieData, TitleStyle titleStyle)| +|InitComponent()||public override void InitComponent()| +|OnLegendButtonClick()||public override void OnLegendButtonClick(int index, string legendName, bool show)| +|OnLegendButtonEnter()||public override void OnLegendButtonEnter(int index, string legendName)| +|OnLegendButtonExit()||public override void OnLegendButtonExit(int index, string legendName)| +|OnPointerClick()||public override void OnPointerClick(PointerEventData eventData)| +|OnPointerDown()||public override void OnPointerDown(PointerEventData eventData)| +|RefreshEndLabelInternal()||public virtual void RefreshEndLabelInternal()| +|RefreshLabelInternal()||public override void RefreshLabelInternal()| +|RefreshLabelNextFrame()||public override void RefreshLabelNextFrame()| +|RemoveComponent()||public override void RemoveComponent()| +|Update()||public override void Update()| ## SerieHandlerAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| SerieHandlerAttribute() |public SerieHandlerAttribute(Type handler)| -| SerieHandlerAttribute() |public SerieHandlerAttribute(Type handler, bool allowMultiple)| +|public method|since|description| +|--|--|--| +|SerieHandlerAttribute()||public SerieHandlerAttribute(Type handler)| +|SerieHandlerAttribute()||public SerieHandlerAttribute(Type handler, bool allowMultiple)| ## SerieHelper -|public method|description| -|--|--| -| CloneSerie<T>() |public static T CloneSerie<T>(Serie serie) where T : Serie| -| CopySerie() |public static void CopySerie(Serie oldSerie, Serie newSerie)| -| GetAllMinMaxData() |public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)| -| GetAreaStyle() |public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData)| -| GetAverageData() |public static double GetAverageData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetBlurStyle() |public static BlurStyle GetBlurStyle(Serie serie, SerieData serieData)| -| GetEmphasisStyle() |public static EmphasisStyle GetEmphasisStyle(Serie serie, SerieData serieData)| -| GetItemColor() |public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)| -| GetItemFormatter() |public static string GetItemFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)| -| GetItemMarker() |public static string GetItemMarker(Serie serie, SerieData serieData, string defaultMarker = null)| -| GetItemStyle() |public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| -| GetLineColor() |public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto)| -| GetLineStyle() |public static LineStyle GetLineStyle(Serie serie, SerieData serieData)| -| GetMaxData() |public static double GetMaxData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetMaxSerieData() |public static SerieData GetMaxSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetMedianData() |public static double GetMedianData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetMinData() |public static double GetMinData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetMinMaxData() |public static void GetMinMaxData(Serie serie, out double min, out double max, DataZoom dataZoom = null, int dimension = 0)
Gets the maximum and minimum values of all data in the serie. | -| GetMinSerieData() |public static SerieData GetMinSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetNumericFormatter() |public static string GetNumericFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)| -| GetSelectStyle() |public static SelectStyle GetSelectStyle(Serie serie, SerieData serieData)| -| GetSerieLabel() |public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| -| GetSerieLabelLine() |public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| -| GetSerieState() |public static SerieState GetSerieState(Serie serie)| -| GetSerieState() |public static SerieState GetSerieState(Serie serie, SerieData serieData, bool defaultSerieState = false)| -| GetSerieState() |public static SerieState GetSerieState(SerieData serieData)| -| GetSerieSymbol() |public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| -| GetStateStyle() |public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)| -| GetSysmbolSize() |public static float GetSysmbolSize(Serie serie, SerieData serieData, ThemeStyle theme, float defaultSize, SerieState state = SerieState.Auto)| -| GetTitleStyle() |public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData)| -| IsAllZeroValue() |public static bool IsAllZeroValue(Serie serie, int dimension = 1)
Whether the data for the specified dimension of serie are all 0. | -| IsDownPoint() |public static bool IsDownPoint(Serie serie, int index)| -| UpdateCenter() |public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)
更新运行时中心点和半径 | -| UpdateFilterData() |public static void UpdateFilterData(Serie serie, DataZoom dataZoom)
根据dataZoom更新数据列表缓存 | -| UpdateMinMaxData() |public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)
获得指定维数的最大最小值 | -| UpdateRect() |public static void UpdateRect(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)| -| UpdateSerieRuntimeFilterData() |public static void UpdateSerieRuntimeFilterData(Serie serie, bool filterInvisible = true)| +|public method|since|description| +|--|--|--| +|CloneSerie<T>()||public static T CloneSerie<T>(Serie serie) where T : Serie| +|CopySerie()||public static void CopySerie(Serie oldSerie, Serie newSerie)| +|GetAllMinMaxData()||public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)| +|GetAreaStyle()||public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData)| +|GetAverageData()||public static double GetAverageData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetBlurStyle()||public static BlurStyle GetBlurStyle(Serie serie, SerieData serieData)| +|GetEmphasisStyle()||public static EmphasisStyle GetEmphasisStyle(Serie serie, SerieData serieData)| +|GetItemColor()||public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)| +|GetItemFormatter()||public static string GetItemFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)| +|GetItemMarker()||public static string GetItemMarker(Serie serie, SerieData serieData, string defaultMarker = null)| +|GetItemStyle()||public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| +|GetLineColor()||public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto)| +|GetLineStyle()||public static LineStyle GetLineStyle(Serie serie, SerieData serieData)| +|GetMaxData()||public static double GetMaxData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetMaxSerieData()||public static SerieData GetMaxSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetMedianData()||public static double GetMedianData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetMinData()||public static double GetMinData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetMinMaxData()||public static void GetMinMaxData(Serie serie, out double min, out double max, DataZoom dataZoom = null, int dimension = 0)
Gets the maximum and minimum values of all data in the serie. | +|GetMinSerieData()||public static SerieData GetMinSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetNumericFormatter()||public static string GetNumericFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)| +|GetSelectStyle()||public static SelectStyle GetSelectStyle(Serie serie, SerieData serieData)| +|GetSerieLabel()||public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| +|GetSerieLabelLine()||public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| +|GetSerieState()||public static SerieState GetSerieState(Serie serie)| +|GetSerieState()||public static SerieState GetSerieState(Serie serie, SerieData serieData, bool defaultSerieState = false)| +|GetSerieState()||public static SerieState GetSerieState(SerieData serieData)| +|GetSerieSymbol()||public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| +|GetStateStyle()||public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)| +|GetSysmbolSize()||public static float GetSysmbolSize(Serie serie, SerieData serieData, ThemeStyle theme, float defaultSize, SerieState state = SerieState.Auto)| +|GetTitleStyle()||public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData)| +|IsAllZeroValue()||public static bool IsAllZeroValue(Serie serie, int dimension = 1)
Whether the data for the specified dimension of serie are all 0. | +|IsDownPoint()||public static bool IsDownPoint(Serie serie, int index)| +|UpdateCenter()||public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)
更新运行时中心点和半径 | +|UpdateFilterData()||public static void UpdateFilterData(Serie serie, DataZoom dataZoom)
根据dataZoom更新数据列表缓存 | +|UpdateMinMaxData()||public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)
获得指定维数的最大最小值 | +|UpdateRect()||public static void UpdateRect(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)| +|UpdateSerieRuntimeFilterData()||public static void UpdateSerieRuntimeFilterData(Serie serie, bool filterInvisible = true)| ## SerieLabelHelper -|public method|description| -|--|--| -| AvoidLabelOverlap() |public static void AvoidLabelOverlap(Serie serie, ComponentTheme theme)| -| CanShowLabel() |public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)| -| GetLabelColor() |public static Color GetLabelColor(Serie serie, ThemeStyle theme, int index)| -| GetRealLabelPosition() |public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)| -| SetGaugeLabelText() |public static void SetGaugeLabelText(Serie serie)| -| UpdatePieLabelPosition() |public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)| +|public method|since|description| +|--|--|--| +|AvoidLabelOverlap()||public static void AvoidLabelOverlap(Serie serie, ComponentTheme theme)| +|CanShowLabel()||public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)| +|GetLabelColor()||public static Color GetLabelColor(Serie serie, ThemeStyle theme, int index)| +|GetRealLabelPosition()||public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)| +|SetGaugeLabelText()||public static void SetGaugeLabelText(Serie serie)| +|UpdatePieLabelPosition()||public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)| ## SerieLabelPool -|public method|description| -|--|--| -| ClearAll() |public static void ClearAll()| -| Release() |public static void Release(GameObject element)| -| ReleaseAll() |public static void ReleaseAll(Transform parent)| +|public method|since|description| +|--|--|--| +|ClearAll()||public static void ClearAll()| +|Release()||public static void Release(GameObject element)| +|ReleaseAll()||public static void ReleaseAll(Transform parent)| ## SerieParams ## SeriesHelper -|public method|description| -|--|--| -| GetLastStackSerie() |public static Serie GetLastStackSerie(List<Serie> series, Serie serie)
获得上一个同堆叠且显示的serie。 | -| GetLegalSerieNameList() |public static List<string> GetLegalSerieNameList(List<Serie> series)| -| GetMaxSerieDataCount() |public static int GetMaxSerieDataCount(List<Serie> series)| -| GetNameColor() |public static Color GetNameColor(BaseChart chart, int index, string name)| -| GetStackSeries() |public static void GetStackSeries(List<Serie> series, ref Dictionary<int, List<Serie>> stackSeries)
获得堆叠系列列表 | -| IsAnyClipSerie() |public static bool IsAnyClipSerie(List<Serie> series)
是否有需裁剪的serie。 | -| IsLegalLegendName() |public static bool IsLegalLegendName(string name)| -| IsPercentStack<T>() |public static bool IsPercentStack<T>(List<Serie> series) where T : Serie
是否时百分比堆叠 | -| IsPercentStack<T>() |public static bool IsPercentStack<T>(List<Serie> series, string stackName) where T : Serie
是否时百分比堆叠 | -| IsStack() |public static bool IsStack(List<Serie> series)
是否由数据堆叠 | -| IsStack<T>() |public static bool IsStack<T>(List<Serie> series, string stackName) where T : Serie
是否堆叠 | -| UpdateSerieNameList() |public static void UpdateSerieNameList(BaseChart chart, ref List<string> serieNameList)
获得所有系列名,不包含空名字。 | -| UpdateStackDataList() |public static void UpdateStackDataList(List<Serie> series, Serie currSerie, DataZoom dataZoom, List<List<SerieData>> dataList)| +|public method|since|description| +|--|--|--| +|GetLastStackSerie()||public static Serie GetLastStackSerie(List<Serie> series, Serie serie)
获得上一个同堆叠且显示的serie。 | +|GetLegalSerieNameList()||public static List<string> GetLegalSerieNameList(List<Serie> series)| +|GetMaxSerieDataCount()||public static int GetMaxSerieDataCount(List<Serie> series)| +|GetNameColor()||public static Color GetNameColor(BaseChart chart, int index, string name)| +|GetStackSeries()||public static void GetStackSeries(List<Serie> series, ref Dictionary<int, List<Serie>> stackSeries)
获得堆叠系列列表 | +|IsAnyClipSerie()||public static bool IsAnyClipSerie(List<Serie> series)
是否有需裁剪的serie。 | +|IsLegalLegendName()||public static bool IsLegalLegendName(string name)| +|IsPercentStack<T>()||public static bool IsPercentStack<T>(List<Serie> series) where T : Serie
是否时百分比堆叠 | +|IsPercentStack<T>()||public static bool IsPercentStack<T>(List<Serie> series, string stackName) where T : Serie
是否时百分比堆叠 | +|IsStack()||public static bool IsStack(List<Serie> series)
是否由数据堆叠 | +|IsStack<T>()||public static bool IsStack<T>(List<Serie> series, string stackName) where T : Serie
是否堆叠 | +|UpdateSerieNameList()||public static void UpdateSerieNameList(BaseChart chart, ref List<string> serieNameList)
获得所有系列名,不包含空名字。 | +|UpdateStackDataList()||public static void UpdateStackDataList(List<Serie> series, Serie currSerie, DataZoom dataZoom, List<List<SerieData>> dataList)| ## SimplifiedBarChart @@ -956,17 +1075,17 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Since() |public Since(string version)| +|public method|since|description| +|--|--|--| +|Since()||public Since(string version)| ## SVG -|public method|description| -|--|--| -| DrawPath() |public static void DrawPath(VertexHelper vh, string path)| -| DrawPath() |public static void DrawPath(VertexHelper vh, SVGPath path)| -| Test() |public static void Test(VertexHelper vh)| +|public method|since|description| +|--|--|--| +|DrawPath()||public static void DrawPath(VertexHelper vh, string path)| +|DrawPath()||public static void DrawPath(VertexHelper vh, SVGPath path)| +|Test()||public static void Test(VertexHelper vh)| ## SVGImage @@ -974,17 +1093,17 @@ Inherits or Implemented: [MaskableGraphic](#maskablegraphic) ## SVGPath -|public method|description| -|--|--| -| AddSegment() |public void AddSegment(SVGPathSeg seg)| -| Draw() |public void Draw(VertexHelper vh)| -| Parse() |public static SVGPath Parse(string path)| +|public method|since|description| +|--|--|--| +|AddSegment()||public void AddSegment(SVGPathSeg seg)| +|Draw()||public void Draw(VertexHelper vh)| +|Parse()||public static SVGPath Parse(string path)| ## SVGPathSeg -|public method|description| -|--|--| -| SVGPathSeg() |public SVGPathSeg(SVGPathSegType type)| +|public method|since|description| +|--|--|--| +|SVGPathSeg()||public SVGPathSeg(SVGPathSegType type)| ## TooltipContext @@ -992,47 +1111,47 @@ Inherits or Implemented: [MaskableGraphic](#maskablegraphic) ## TooltipHelper -|public method|description| -|--|--| -| GetItemNumericFormatter() |public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)| -| GetLineColor() |public static Color32 GetLineColor(Tooltip tooltip, Color32 defaultColor)| -| IsIgnoreFormatter() |public static bool IsIgnoreFormatter(string itemFormatter)| -| LimitInRect() |public static void LimitInRect(Tooltip tooltip, Rect chartRect)| +|public method|since|description| +|--|--|--| +|GetItemNumericFormatter()||public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)| +|GetLineColor()||public static Color32 GetLineColor(Tooltip tooltip, Color32 defaultColor)| +|IsIgnoreFormatter()||public static bool IsIgnoreFormatter(string itemFormatter)| +|LimitInRect()||public static void LimitInRect(Tooltip tooltip, Rect chartRect)| ## TooltipView -|public method|description| -|--|--| -| CreateView() |public static TooltipView CreateView(Tooltip tooltip, ThemeStyle theme, Transform parent)| -| GetCurrentPos() |public Vector3 GetCurrentPos()| -| GetTargetPos() |public Vector3 GetTargetPos()| -| Refresh() |public void Refresh()| -| SetActive() |public void SetActive(bool flag)| -| Update() |public void Update()| -| UpdatePosition() |public void UpdatePosition(Vector3 pos)| +|public method|since|description| +|--|--|--| +|CreateView()||public static TooltipView CreateView(Tooltip tooltip, ThemeStyle theme, Transform parent)| +|GetCurrentPos()||public Vector3 GetCurrentPos()| +|GetTargetPos()||public Vector3 GetTargetPos()| +|Refresh()||public void Refresh()| +|SetActive()||public void SetActive(bool flag)| +|Update()||public void Update()| +|UpdatePosition()||public void UpdatePosition(Vector3 pos)| ## TooltipViewItem ## UGL -|public method|description| -|--|--| -| DrawDiamond() |public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color)
Draw a diamond. 画菱形(钻石形状) | -| DrawDiamond() |public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color, Color32 toColor)
Draw a diamond. 画菱形(钻石形状) | -| DrawEllipse() |public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)| -| DrawLine() |public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)| -| DrawLine() |public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)
Draw a line. 画直线 | -| DrawLine() |public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)
Draw a line. 画直线 | -| DrawPolygon() |public static void DrawPolygon(VertexHelper vh, List<Vector3> points, Color32 color)
填充任意多边形(目前只支持凸多边形) | -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)| -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color, Color32 toColor)| -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color)| -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color, Color32 toColor)| -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Vector3 p1, Vector3 p2, float radius, Color32 color)
Draw a rectangle. 画带长方形 | -| DrawSquare() |public static void DrawSquare(VertexHelper vh, Vector3 center, float radius, Color32 color)
Draw a square. 画正方形 | -| DrawSvgPath() |public static void DrawSvgPath(VertexHelper vh, string path)| -| DrawTriangle() |public static void DrawTriangle(VertexHelper vh, Vector3 pos, float size, Color32 color)| -| DrawTriangle() |public static void DrawTriangle(VertexHelper vh, Vector3 pos, float size, Color32 color, Color32 toColor)| +|public method|since|description| +|--|--|--| +|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color)
Draw a diamond. 画菱形(钻石形状) | +|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color, Color32 toColor)
Draw a diamond. 画菱形(钻石形状) | +|DrawEllipse()||public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)| +|DrawLine()||public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)| +|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)
Draw a line. 画直线 | +|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)
Draw a line. 画直线 | +|DrawPolygon()||public static void DrawPolygon(VertexHelper vh, List<Vector3> points, Color32 color)
填充任意多边形(目前只支持凸多边形) | +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)| +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color, Color32 toColor)| +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color)| +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color, Color32 toColor)| +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Vector3 p1, Vector3 p2, float radius, Color32 color)
Draw a rectangle. 画带长方形 | +|DrawSquare()||public static void DrawSquare(VertexHelper vh, Vector3 center, float radius, Color32 color)
Draw a square. 画正方形 | +|DrawSvgPath()||public static void DrawSvgPath(VertexHelper vh, string path)| +|DrawTriangle()||public static void DrawTriangle(VertexHelper vh, Vector3 pos, float size, Color32 color)| +|DrawTriangle()||public static void DrawTriangle(VertexHelper vh, Vector3 pos, float size, Color32 color, Color32 toColor)| ## UGLExample @@ -1040,30 +1159,44 @@ Inherits or Implemented: [MaskableGraphic](#maskablegraphic) ## UGLHelper -|public method|description| -|--|--| -| GetAngle360() |public static float GetAngle360(Vector2 from, Vector2 to)
获得0-360的角度(12点钟方向为0度) | -| GetBezier() |public static Vector3 GetBezier(float t, Vector3 sp, Vector3 cp, Vector3 ep)| -| GetBezier2() |public static Vector3 GetBezier2(float t, Vector3 sp, Vector3 p1, Vector3 p2, Vector3 ep)| -| GetBezierList() |public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)| -| GetDire() |public static Vector3 GetDire(float angle, bool isDegree = false)| -| GetIntersection() |public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref Vector3 intersection)
获得两直线的交点 | -| GetPos() |public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)| -| GetVertialDire() |public static Vector3 GetVertialDire(Vector3 dire)| -| IsClearColor() |public static bool IsClearColor(Color color)| -| IsClearColor() |public static bool IsClearColor(Color32 color)| -| IsPointInPolygon() |public static bool IsPointInPolygon(Vector3 p, List<Vector2> polyons)| -| IsPointInPolygon() |public static bool IsPointInPolygon(Vector3 p, List<Vector3> polyons)| -| IsPointInTriangle() |public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)| -| IsValueEqualsColor() |public static bool IsValueEqualsColor(Color color1, Color color2)| -| IsValueEqualsColor() |public static bool IsValueEqualsColor(Color32 color1, Color32 color2)| -| IsValueEqualsList<T>() |public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)| -| IsValueEqualsString() |public static bool IsValueEqualsString(string str1, string str2)| -| IsValueEqualsVector2() |public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)| -| IsValueEqualsVector3() |public static bool IsValueEqualsVector3(Vector3 v1, Vector2 v2)| -| IsValueEqualsVector3() |public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)| -| IsZeroVector() |public static bool IsZeroVector(Vector3 pos)| -| RotateRound() |public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)| +|public method|since|description| +|--|--|--| +|GetAngle360()||public static float GetAngle360(Vector2 from, Vector2 to)
获得0-360的角度(12点钟方向为0度) | +|GetBezier()||public static Vector3 GetBezier(float t, Vector3 sp, Vector3 cp, Vector3 ep)| +|GetBezier2()||public static Vector3 GetBezier2(float t, Vector3 sp, Vector3 p1, Vector3 p2, Vector3 ep)| +|GetBezierList()||public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)| +|GetDire()||public static Vector3 GetDire(float angle, bool isDegree = false)| +|GetIntersection()||public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref Vector3 intersection)
获得两直线的交点 | +|GetPos()||public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)| +|GetVertialDire()||public static Vector3 GetVertialDire(Vector3 dire)| +|IsClearColor()||public static bool IsClearColor(Color color)| +|IsClearColor()||public static bool IsClearColor(Color32 color)| +|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List<Vector2> polyons)| +|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List<Vector3> polyons)| +|IsPointInTriangle()||public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)| +|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color color1, Color color2)| +|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color32 color1, Color32 color2)| +|IsValueEqualsList<T>()||public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)| +|IsValueEqualsString()||public static bool IsValueEqualsString(string str1, string str2)| +|IsValueEqualsVector2()||public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)| +|IsValueEqualsVector3()||public static bool IsValueEqualsVector3(Vector3 v1, Vector2 v2)| +|IsValueEqualsVector3()||public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)| +|IsZeroVector()||public static bool IsZeroVector(Vector3 pos)| +|RotateRound()||public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)| + +## UIComponent + +Inherits or Implemented: [BaseGraph](#basegraph) + +|public method|since|description| +|--|--|--| +|UpdateTheme()||public bool UpdateTheme(ThemeType theme)
Update chart theme. | + +## UIHelper + +|public method|since|description| +|--|--|--| +|GetBackgroundColor()||public static Color32 GetBackgroundColor(UIComponent component)| ## VisualMapContext @@ -1071,58 +1204,54 @@ Inherits or Implemented: [MainComponentContext](#maincomponentcontext) ## VisualMapHelper -|public method|description| -|--|--| -| AutoSetLineMinMax() |public static void AutoSetLineMinMax(VisualMap visualMap, Serie serie, bool isY, Axis axis, Axis relativedAxis)| -| GetDimension() |public static int GetDimension(VisualMap visualMap, int defaultDimension)| -| IsNeedAreaGradient() |public static bool IsNeedAreaGradient(VisualMap visualMap)| -| IsNeedGradient() |public static bool IsNeedGradient(VisualMap visualMap)| -| IsNeedLineGradient() |public static bool IsNeedLineGradient(VisualMap visualMap)| -| SetMinMax() |public static void SetMinMax(VisualMap visualMap, double min, double max)| +|public method|since|description| +|--|--|--| +|AutoSetLineMinMax()||public static void AutoSetLineMinMax(VisualMap visualMap, Serie serie, bool isY, Axis axis, Axis relativedAxis)| +|GetDimension()||public static int GetDimension(VisualMap visualMap, int defaultDimension)| +|IsNeedAreaGradient()||public static bool IsNeedAreaGradient(VisualMap visualMap)| +|IsNeedGradient()||public static bool IsNeedGradient(VisualMap visualMap)| +|IsNeedLineGradient()||public static bool IsNeedLineGradient(VisualMap visualMap)| +|SetMinMax()||public static void SetMinMax(VisualMap visualMap, double min, double max)| ## XChartsMgr -|public method|description| -|--|--| -| AddChart() |public static void AddChart(BaseChart chart)| -| ContainsChart() |public static bool ContainsChart(BaseChart chart)| -| ContainsChart() |public static bool ContainsChart(string chartName)| -| DisableTextMeshPro() |public static void DisableTextMeshPro()| -| EnableTextMeshPro() |public static void EnableTextMeshPro()| -| GetChart() |public static BaseChart GetChart(string chartName)| -| GetCharts() |public static List<BaseChart> GetCharts(string chartName)| -| GetPackageFullPath() |public static string GetPackageFullPath()| -| GetRepeatChartNameInfo() |public static string GetRepeatChartNameInfo(BaseChart chart, string chartName)| -| IsExistTMPAssembly() |public static bool IsExistTMPAssembly()| -| IsRepeatChartName() |public static bool IsRepeatChartName(BaseChart chart, string chartName = null)| -| ModifyTMPRefence() |public static bool ModifyTMPRefence(bool removeTMP = false)| -| RemoveAllChartObject() |public static void RemoveAllChartObject()| -| RemoveChart() |public static void RemoveChart(string chartName)| +|public method|since|description| +|--|--|--| +|AddChart()||public static void AddChart(BaseChart chart)| +|ContainsChart()||public static bool ContainsChart(BaseChart chart)| +|ContainsChart()||public static bool ContainsChart(string chartName)| +|GetChart()||public static BaseChart GetChart(string chartName)| +|GetCharts()||public static List<BaseChart> GetCharts(string chartName)| +|GetPackageFullPath()||public static string GetPackageFullPath()| +|GetRepeatChartNameInfo()||public static string GetRepeatChartNameInfo(BaseChart chart, string chartName)| +|IsRepeatChartName()||public static bool IsRepeatChartName(BaseChart chart, string chartName = null)| +|RemoveAllChartObject()||public static void RemoveAllChartObject()| +|RemoveChart()||public static void RemoveChart(string chartName)| ## XCResourceImporterWindow Inherits or Implemented: [UnityEditor.EditorWindow](#unityeditor.editorwindow) -|public method|description| -|--|--| -| ShowPackageImporterWindow() |public static void ShowPackageImporterWindow()| +|public method|since|description| +|--|--|--| +|ShowPackageImporterWindow()||public static void ShowPackageImporterWindow()| ## XCThemeMgr -|public method|description| -|--|--| -| AddTheme() |public static void AddTheme(Theme theme)| -| CheckReloadTheme() |public static void CheckReloadTheme()| -| ContainsTheme() |public static bool ContainsTheme(string themeName)| -| ExportTheme() |public static bool ExportTheme(Theme theme)| -| ExportTheme() |public static bool ExportTheme(Theme theme, string themeNewName)| -| GetAllThemeNames() |public static List<string> GetAllThemeNames()| -| GetTheme() |public static Theme GetTheme(string themeName)| -| GetTheme() |public static Theme GetTheme(ThemeType type)| -| GetThemeAssetPath() |public static string GetThemeAssetPath(string themeName)| -| GetThemeList() |public static List<Theme> GetThemeList()| -| LoadTheme() |public static Theme LoadTheme(string themeName)| -| LoadTheme() |public static Theme LoadTheme(ThemeType type)| -| ReloadThemeList() |public static void ReloadThemeList()
重新加载主题列表 | -| SwitchTheme() |public static void SwitchTheme(BaseChart chart, string themeName)| +|public method|since|description| +|--|--|--| +|AddTheme()||public static void AddTheme(Theme theme)| +|CheckReloadTheme()||public static void CheckReloadTheme()| +|ContainsTheme()||public static bool ContainsTheme(string themeName)| +|ExportTheme()||public static bool ExportTheme(Theme theme)| +|ExportTheme()||public static bool ExportTheme(Theme theme, string themeNewName)| +|GetAllThemeNames()||public static List<string> GetAllThemeNames()| +|GetTheme()||public static Theme GetTheme(string themeName)| +|GetTheme()||public static Theme GetTheme(ThemeType type)| +|GetThemeAssetPath()||public static string GetThemeAssetPath(string themeName)| +|GetThemeList()||public static List<Theme> GetThemeList()| +|LoadTheme()||public static Theme LoadTheme(string themeName)| +|LoadTheme()||public static Theme LoadTheme(ThemeType type)| +|ReloadThemeList()||public static void ReloadThemeList()
重新加载主题列表 | +|SwitchTheme()||public static void SwitchTheme(BaseChart chart, string themeName)| diff --git a/Documentation~/en/changelog.md b/Documentation~/en/changelog.md index e353fe6b..89ae3019 100644 --- a/Documentation~/en/changelog.md +++ b/Documentation~/en/changelog.md @@ -2,6 +2,7 @@ # 更新日志 [master](#master) +[v3.6.0](#v360) [v3.5.0](#v350) [v3.4.0](#v340) [v3.3.0](#v330) @@ -60,6 +61,41 @@ ## master +## v3.6.0 + +* (2023.04.01) Release `v3.6.0` version +* (2023.03.14) Fix for Tooltip's `titleFormater` setting `{b}` may not take effect +* (2023.03.14) Fix for `BarChart` not drawing bar background when data is 0 (#250) (by __Ambitroc__) +* (2023.03.12) Added `LabelStyle` `autoRotate` to set automatic rotation of angled vertical text +* (2023.03.10) Added `VR` and other non-mouse input for Point location acquisition (#248) (by __Ambitroc__) +* (2023.03.09) Adds callbacks to Chart's `onSerieClick`, `onSerieDown`, `onSerieEnter` and `onSerieExit` +* (2023.03.09) Fixed click-check offset for `Pie` not taking effect +* (2023.03.04) Added Positions for Legend to customize legend positions +* (2023.03.03) Fixed `Animation` changing animation that might not work +* (2023.02.28) Fixed issue with Serie's Label not refreshing when `Legend` is clicked +* (2023.02.26) Adds DataZoom's `startEndFunction` delegate +* (2023.02.12) Refactor the Component code and adjust the API +* (2023.02.10) Fix `Axis` with incorrect minimum in `Log` axis in some cases +* (2023.02.10) Optimizes the default display format of Axis's value Label +* (2023.02.08) Added startLock and endLock for DataZoom +* (2023.02.02) Fixed bug where datazoom xaxis label could be displayed off-chart when datazoom is turned on +* (2023.02.02) Optimizes the `ignore` setting of `SerieData` to ignore data +* (2023.02.01) Fix `XChartsMgr.ContainsChart()` interface exception +* (2023.01.31) Added support for `InputSystem` (#242) (by __Bian-Sh__) +* (2023.01.11) Fixed chart not refreshing after removing Component from Inspector (#241) +* (2023.01.06) Fixed bug with `Pie` displaying abnormal Label when the last few values are 0 (#240) +* (2023.01.03) deletes serie `MarkColor` and adds ItemStyle `MarkColor` +* (2022.12.29) Added `+` to list editor +* (2022.12.29) Fixed `UpdateXYData()` interface affecting data accuracy (#238) +* (2022.12.28) Fixed abnormal display when setting `border` when `Pie` has only one data (#237) +* (2022.12.22) Adjust `Covert` rename to `Convert`, involving interfaces such as: `ConvertXYAxis()`, `CovertSerie()`, etc +* (2022.12.22) Fixed abnormal display of `Label` after `Convert XY Axis` +* (2022.12.12) Fixed an issue where the `Value` Axis of `axis` calculated the value range incorrectly in some cases +* (2022.12.12) Optimized legend's formatter to support `{h}` wildcards +* (2022.12.12) Fixed abnormal display of Legend's formatter when set to a fixed value +* (2022.12.08) Added `AreaStyle` `toTop` parameter to set whether the line graph gradient goes to the top or to the actual position +* (2022.12.07) Adds text wildcard `{h}` for `Formatter` to support setting current color values + ## v3.5.0 Highlights: @@ -610,7 +646,7 @@ Details: * (2020.04.19) 优化`LineChart`折线图的区域填充渐变效果 * (2020.04.19) 增加`AxisLabel`的`onZero`参数可将`Label`显示在`0`刻度上 * (2020.04.19) 增加`Serie`和`AxisLabel`的`showAsPositiveNumber`参数将负数数值显示为正数 -* (2020.04.18) 增加`Covert XY Axis`互换XY轴配置 +* (2020.04.18) 增加`Convert XY Axis`互换XY轴配置 * (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转 * (2020.04.16) 修复`Check warning`在`Unity2019.3`上的显示问题 * (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题 diff --git a/Documentation~/en/configuration.md b/Documentation~/en/configuration.md index 8c744ced..450da862 100644 --- a/Documentation~/en/configuration.md +++ b/Documentation~/en/configuration.md @@ -1,5 +1,5 @@ --- -sidebar_position: 2 +sidebar_position: 31 slug: /configuration --- @@ -7,76 +7,176 @@ slug: /configuration ## Serie -||||| -|--|--|--|--| -|[Bar](#bar)|[BaseScatter](#basescatter)|[Candlestick](#candlestick)|[EffectScatter](#effectscatter)| -|[Heatmap](#heatmap)|[Line](#line)|[Parallel](#parallel)|[Pie](#pie)| -|[Radar](#radar)|[Ring](#ring)|[Scatter](#scatter)|[Serie](#serie)| -|[SimplifiedBar](#simplifiedbar)|[SimplifiedCandlestick](#simplifiedcandlestick)|[SimplifiedLine](#simplifiedline)| +- [Bar](#bar) +- [BaseScatter](#basescatter) +- [Candlestick](#candlestick) +- [EffectScatter](#effectscatter) +- [Heatmap](#heatmap) +- [Line](#line) +- [Parallel](#parallel) +- [Pie](#pie) +- [Radar](#radar) +- [Ring](#ring) +- [Scatter](#scatter) +- [Serie](#serie) +- [SimplifiedBar](#simplifiedbar) +- [SimplifiedCandlestick](#simplifiedcandlestick) +- [SimplifiedLine](#simplifiedline) + ## Theme -||||| -|--|--|--|--| -|[AngleAxisTheme](#angleaxistheme)|[AxisTheme](#axistheme)|[BaseAxisTheme](#baseaxistheme)|[ComponentTheme](#componenttheme)| -|[DataZoomTheme](#datazoomtheme)|[LegendTheme](#legendtheme)|[PolarAxisTheme](#polaraxistheme)|[RadarAxisTheme](#radaraxistheme)| -|[RadiusAxisTheme](#radiusaxistheme)|[SerieTheme](#serietheme)|[SubTitleTheme](#subtitletheme)|[Theme](#theme)| -|[ThemeStyle](#themestyle)|[TitleTheme](#titletheme)|[TooltipTheme](#tooltiptheme)|[VisualMapTheme](#visualmaptheme)| +- [AngleAxisTheme](#angleaxistheme) +- [AxisTheme](#axistheme) +- [BaseAxisTheme](#baseaxistheme) +- [ComponentTheme](#componenttheme) +- [DataZoomTheme](#datazoomtheme) +- [LegendTheme](#legendtheme) +- [PolarAxisTheme](#polaraxistheme) +- [RadarAxisTheme](#radaraxistheme) +- [RadiusAxisTheme](#radiusaxistheme) +- [SerieTheme](#serietheme) +- [SubTitleTheme](#subtitletheme) +- [Theme](#theme) +- [ThemeStyle](#themestyle) +- [TitleTheme](#titletheme) +- [TooltipTheme](#tooltiptheme) +- [UIComponentTheme](#uicomponenttheme) +- [VisualMapTheme](#visualmaptheme) + ## MainComponent -||||| -|--|--|--|--| -|[AngleAxis](#angleaxis)|[Axis](#axis)|[Background](#background)|[CalendarCoord](#calendarcoord)| -|[Comment](#comment)|[CoordSystem](#coordsystem)|[DataZoom](#datazoom)|[GridCoord](#gridcoord)| -|[Legend](#legend)|[MarkArea](#markarea)|[MarkLine](#markline)|[ParallelAxis](#parallelaxis)| -|[ParallelCoord](#parallelcoord)|[PolarCoord](#polarcoord)|[RadarCoord](#radarcoord)|[RadiusAxis](#radiusaxis)| -|[Settings](#settings)|[SingleAxis](#singleaxis)|[SingleAxisCoord](#singleaxiscoord)|[Title](#title)| -|[Tooltip](#tooltip)|[VisualMap](#visualmap)|[XAxis](#xaxis)|[YAxis](#yaxis)| +- [AngleAxis](#angleaxis) +- [Axis](#axis) +- [Background](#background) +- [CalendarCoord](#calendarcoord) +- [Comment](#comment) +- [CoordSystem](#coordsystem) +- [DataZoom](#datazoom) +- [GridCoord](#gridcoord) +- [Legend](#legend) +- [MarkArea](#markarea) +- [MarkLine](#markline) +- [ParallelAxis](#parallelaxis) +- [ParallelCoord](#parallelcoord) +- [PolarCoord](#polarcoord) +- [RadarCoord](#radarcoord) +- [RadiusAxis](#radiusaxis) +- [Settings](#settings) +- [SingleAxis](#singleaxis) +- [SingleAxisCoord](#singleaxiscoord) +- [Title](#title) +- [Tooltip](#tooltip) +- [VisualMap](#visualmap) +- [XAxis](#xaxis) +- [YAxis](#yaxis) + ## ChildComponent -||||| -|--|--|--|--| -|[AngleAxisTheme](#angleaxistheme)|[AnimationStyle](#animationstyle)|[AreaStyle](#areastyle)|[ArrowStyle](#arrowstyle)| -|[AxisLabel](#axislabel)|[AxisLine](#axisline)|[AxisMinorSplitLine](#axisminorsplitline)|[AxisMinorTick](#axisminortick)| -|[AxisName](#axisname)|[AxisSplitArea](#axissplitarea)|[AxisSplitLine](#axissplitline)|[AxisTheme](#axistheme)| -|[AxisTick](#axistick)|[BaseAxisTheme](#baseaxistheme)|[BaseLine](#baseline)|[BlurStyle](#blurstyle)| -|[CommentItem](#commentitem)|[CommentMarkStyle](#commentmarkstyle)|[ComponentTheme](#componenttheme)|[DataZoomTheme](#datazoomtheme)| -|[EmphasisStyle](#emphasisstyle)|[EndLabelStyle](#endlabelstyle)|[IconStyle](#iconstyle)|[ImageStyle](#imagestyle)| -|[ItemStyle](#itemstyle)|[LabelLine](#labelline)|[LabelStyle](#labelstyle)|[LegendTheme](#legendtheme)| -|[Level](#level)|[LevelStyle](#levelstyle)|[LineArrow](#linearrow)|[LineStyle](#linestyle)| -|[Location](#location)|[MarkAreaData](#markareadata)|[MarkLineData](#marklinedata)|[MarqueeStyle](#marqueestyle)| -|[Padding](#padding)|[PolarAxisTheme](#polaraxistheme)|[RadarAxisTheme](#radaraxistheme)|[RadiusAxisTheme](#radiusaxistheme)| -|[SelectStyle](#selectstyle)|[SerieData](#seriedata)|[SerieSymbol](#seriesymbol)|[SerieTheme](#serietheme)| -|[StageColor](#stagecolor)|[StateStyle](#statestyle)|[SubTitleTheme](#subtitletheme)|[SymbolStyle](#symbolstyle)| -|[TextLimit](#textlimit)|[TextPadding](#textpadding)|[TextStyle](#textstyle)|[ThemeStyle](#themestyle)| -|[TitleStyle](#titlestyle)|[TitleTheme](#titletheme)|[TooltipTheme](#tooltiptheme)|[VisualMapRange](#visualmaprange)| -|[VisualMapTheme](#visualmaptheme)| +- [AngleAxisTheme](#angleaxistheme) +- [AnimationStyle](#animationstyle) +- [AreaStyle](#areastyle) +- [ArrowStyle](#arrowstyle) +- [AxisLabel](#axislabel) +- [AxisLine](#axisline) +- [AxisMinorSplitLine](#axisminorsplitline) +- [AxisMinorTick](#axisminortick) +- [AxisName](#axisname) +- [AxisSplitArea](#axissplitarea) +- [AxisSplitLine](#axissplitline) +- [AxisTheme](#axistheme) +- [AxisTick](#axistick) +- [BaseAxisTheme](#baseaxistheme) +- [BaseLine](#baseline) +- [BlurStyle](#blurstyle) +- [CommentItem](#commentitem) +- [CommentMarkStyle](#commentmarkstyle) +- [ComponentTheme](#componenttheme) +- [DataZoomTheme](#datazoomtheme) +- [EmphasisStyle](#emphasisstyle) +- [EndLabelStyle](#endlabelstyle) +- [IconStyle](#iconstyle) +- [ImageStyle](#imagestyle) +- [ItemStyle](#itemstyle) +- [LabelLine](#labelline) +- [LabelStyle](#labelstyle) +- [LegendTheme](#legendtheme) +- [Level](#level) +- [LevelStyle](#levelstyle) +- [LineArrow](#linearrow) +- [LineStyle](#linestyle) +- [Location](#location) +- [MarkAreaData](#markareadata) +- [MarkLineData](#marklinedata) +- [MarqueeStyle](#marqueestyle) +- [Padding](#padding) +- [PolarAxisTheme](#polaraxistheme) +- [RadarAxisTheme](#radaraxistheme) +- [RadiusAxisTheme](#radiusaxistheme) +- [SelectStyle](#selectstyle) +- [SerieData](#seriedata) +- [SerieSymbol](#seriesymbol) +- [SerieTheme](#serietheme) +- [StageColor](#stagecolor) +- [StateStyle](#statestyle) +- [SubTitleTheme](#subtitletheme) +- [SymbolStyle](#symbolstyle) +- [TextLimit](#textlimit) +- [TextPadding](#textpadding) +- [TextStyle](#textstyle) +- [ThemeStyle](#themestyle) +- [TitleStyle](#titlestyle) +- [TitleTheme](#titletheme) +- [TooltipTheme](#tooltiptheme) +- [UIComponentTheme](#uicomponenttheme) +- [VisualMapRange](#visualmaprange) +- [VisualMapTheme](#visualmaptheme) -## ISerieExtraComponent -||||| -|--|--|--|--| -|[AreaStyle](#areastyle)|[BlurStyle](#blurstyle)|[EmphasisStyle](#emphasisstyle)|[ImageStyle](#imagestyle)| -|[LabelLine](#labelline)|[LabelStyle](#labelstyle)|[LineArrow](#linearrow)|[SelectStyle](#selectstyle)| -|[TitleStyle](#titlestyle)| +## ISerieComponent + +- [AreaStyle](#areastyle) +- [BlurStyle](#blurstyle) +- [EmphasisStyle](#emphasisstyle) +- [ImageStyle](#imagestyle) +- [LabelLine](#labelline) +- [LabelStyle](#labelstyle) +- [LineArrow](#linearrow) +- [SelectStyle](#selectstyle) +- [TitleStyle](#titlestyle) + ## ISerieDataComponent -||||| -|--|--|--|--| -|[AreaStyle](#areastyle)|[BlurStyle](#blurstyle)|[EmphasisStyle](#emphasisstyle)|[ImageStyle](#imagestyle)| -|[ItemStyle](#itemstyle)|[LabelLine](#labelline)|[LabelStyle](#labelstyle)|[LineStyle](#linestyle)| -|[SelectStyle](#selectstyle)|[SerieSymbol](#seriesymbol)|[TitleStyle](#titlestyle)| +- [AreaStyle](#areastyle) +- [BlurStyle](#blurstyle) +- [EmphasisStyle](#emphasisstyle) +- [ImageStyle](#imagestyle) +- [ItemStyle](#itemstyle) +- [LabelLine](#labelline) +- [LabelStyle](#labelstyle) +- [LineStyle](#linestyle) +- [SelectStyle](#selectstyle) +- [SerieSymbol](#seriesymbol) +- [TitleStyle](#titlestyle) + ## Other Component -||||| -|--|--|--|--| -|[BaseSerie](#baseserie)|[ChartText](#charttext)|[ChildComponent](#childcomponent)|[DebugInfo](#debuginfo)| -|[Indicator](#indicator)|[Lang](#lang)|[LangCandlestick](#langcandlestick)|[LangTime](#langtime)| -|[MainComponent](#maincomponent)|[XCResourcesImporter](#xcresourcesimporter)|[XCSettings](#xcsettings)| +- [BaseSerie](#baseserie) +- [ChartText](#charttext) +- [ChildComponent](#childcomponent) +- [DebugInfo](#debuginfo) +- [Indicator](#indicator) +- [Lang](#lang) +- [LangCandlestick](#langcandlestick) +- [LangTime](#langtime) +- [MainComponent](#maincomponent) +- [XCResourcesImporter](#xcresourcesimporter) +- [XCSettings](#xcsettings) + ## AngleAxis @@ -116,7 +216,7 @@ the animation of serie. ## AreaStyle -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) The style of area. @@ -128,6 +228,7 @@ The style of area. |toColor|||Gradient color, start color to toColor. |opacity|0.6f||Opacity of the component. Supports value from 0 to 1, and the component will not be drawn when set to 0. |innerFill||v3.2.0|Whether to fill only polygonal areas. Currently, only convex polygons are supported. +|toTop|true|v3.6.0|Whether to fill the gradient color to the top. The default is true, which means that the gradient color is filled to the top. If it is false, the gradient color is filled to the actual position. ## ArrowStyle @@ -354,7 +455,7 @@ Inherits or Implemented: [Serie](#serie),[INeedSerieContainer](#ineedseriecontai ## BlurStyle -Inherits or Implemented: [StateStyle](#statestyle),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [StateStyle](#statestyle),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) > Since `v3.2.0` @@ -473,6 +574,8 @@ DataZoom component is used for zooming a specific area, which enables user to in |lineStyle|||阴影线条样式。 [LineStyle](#linestyle)| |areaStyle|||阴影填充样式。 [AreaStyle](#areastyle)| |marqueeStyle||v3.5.0|选取框样式。 [MarqueeStyle](#marqueestyle)| +|startLock||v3.6.0|Lock start value. +|endLock||v3.6.0|Lock end value. ## DataZoomTheme @@ -505,7 +608,7 @@ Inherits or Implemented: [BaseScatter](#basescatter) ## EmphasisStyle -Inherits or Implemented: [StateStyle](#statestyle),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [StateStyle](#statestyle),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) > Since `v3.2.0` @@ -567,7 +670,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent) ## ImageStyle -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) |field|default|since|comment| |--|--|--|--| @@ -622,6 +725,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieDataComponent] |color0|||数据项颜色。 |toColor|||Gradient color1. |toColor2|||Gradient color2.Only valid in line diagrams. +|markColor||v3.6.0|Serie's mark color. It is only used to display Legend and Tooltip, and does not affect the drawing color. The default value is clear. |backgroundColor|||数据项背景颜色。 |backgroundWidth|||数据项背景宽度。 |centerColor|||中心区域颜色。 @@ -639,7 +743,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieDataComponent] ## LabelLine -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) 标签的引导线 @@ -658,7 +762,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent ## LabelStyle -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) Text label of chart, to explain some data information about graphic item like value, name and so on. @@ -669,6 +773,7 @@ Text label of chart, to explain some data information about graphic item like va |autoOffset|false||是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。 |offset|||offset to the host graphic element. |rotate|||Rotation of label. +|autoRotate|false|v3.6.0|auto rotate of label. |distance|||距离轴线的距离。 |formatter|||formatter of label. |numericFormatter|||Standard numeric format strings. @@ -718,6 +823,7 @@ Legend component.The legend component shows different sets of tags, colors, and |colors|||the colors of legend item. |background||v3.1.0|the sytle of background. [ImageStyle](#imagestyle)| |padding||v3.1.0|the paddinng of item and background. [Padding](#padding)| +|positions||v3.6.0|the custom positions of legend item. ## LegendTheme @@ -753,7 +859,7 @@ Inherits or Implemented: [Serie](#serie),[INeedSerieContainer](#ineedseriecontai ## LineArrow -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent) |field|default|since|comment| |--|--|--|--| @@ -986,7 +1092,7 @@ Inherits or Implemented: [BaseScatter](#basescatter) ## SelectStyle -Inherits or Implemented: [StateStyle](#statestyle),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [StateStyle](#statestyle),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) > Since `v3.2.0` @@ -1008,7 +1114,6 @@ Inherits or Implemented: [BaseSerie](#baseserie),[IComparable](#icomparable) |serieName|||Series name used for displaying in tooltip and filtering with legend. |state||v3.2.0|The default state of a serie.
`SerieState`:
- `Normal`: Normal state.
- `Emphasis`: Emphasis state.
- `Blur`: Blur state.
- `Select`: Select state.
- `Auto`: Auto state.
| |colorBy||v3.2.0|The policy to take color from theme.
`SerieColorBy`:
- `Default`: Select state.
- `Serie`: assigns the colors in the palette by serie, so that all data in the same series are in the same color;.
- `Data`: assigns colors in the palette according to data items, with each data item using a different color..
| -|markColor||v3.4.0|Serie's mark color. It is only used to display Legend and Tooltip, and does not affect the drawing color. The default value is clear. |stack|||If stack the value. On the same category axis, the series with the same stack name would be put on top of each other. |xAxisIndex|0||the index of XAxis. |yAxisIndex|0||the index of YAxis. @@ -1024,7 +1129,7 @@ Inherits or Implemented: [BaseSerie](#baseserie),[IComparable](#icomparable) |sampleType|||the type of sample.
`SampleType`:
- `Peak`: Take a peak. When the average value of the filter point is greater than or equal to 'sampleAverage', take the maximum value; If you do it the other way around, you get the minimum.
- `Average`: Take the average of the filter points.
- `Max`: Take the maximum value of the filter point.
- `Min`: Take the minimum value of the filter point.
- `Sum`: Take the sum of the filter points.
| |sampleAverage|0||设定的采样平均值。当sampleType 为 Peak 时,用于和过滤数据的平均值做对比是取最大值还是最小值。默认为0时会实时计算所有数据的平均值。 |lineType|||The type of line chart.
`LineType`:
- `Normal`: the normal line chart,
- `Smooth`: the smooth line chart,
- `StepStart`: step line.
- `StepMiddle`: step line.
- `StepEnd`: step line.
| -|smoothLimit|true|v3.4.0|Whether to restrict the curve. When true, the curve between two continuous data of the same value is restricted to not exceed the data point, and is flat to the data point. +|smoothLimit|false|v3.4.0|Whether to restrict the curve. When true, the curve between two continuous data of the same value is restricted to not exceed the data point, and is flat to the data point. |barType|||柱形图类型。
`BarType`:
- `Normal`: normal bar.
- `Zebra`: zebra bar.
- `Capsule`: capsule bar.
| |barPercentStack|false||柱形图是否为百分比堆积。相同stack的serie只要有一个barPercentStack为true,则就显示成百分比堆叠柱状图。 |barWidth|0||The width of the bar. Adaptive when default 0. @@ -1341,7 +1446,7 @@ Title component, including main title and subtitle. ## TitleStyle -Inherits or Implemented: [LabelStyle](#labelstyle),[ISerieDataComponent](#iseriedatacomponent),[ISerieExtraComponent](#iserieextracomponent) +Inherits or Implemented: [LabelStyle](#labelstyle),[ISerieDataComponent](#iseriedatacomponent),[ISerieComponent](#iseriecomponent) the title of serie. @@ -1404,6 +1509,16 @@ Inherits or Implemented: [ComponentTheme](#componenttheme) |labelTextColor|||the text color of tooltip cross indicator's axis label. |labelBackgroundColor|||the background color of tooltip cross indicator's axis label. +## UIComponentTheme + +Inherits or Implemented: [ChildComponent](#childcomponent) + +|field|default|since|comment| +|--|--|--|--| +|show|true|| +|sharedTheme|||the asset of theme. [Theme](#theme)| +|transparentBackground|false|| + ## VisualMap Inherits or Implemented: [MainComponent](#maincomponent) diff --git a/Documentation~/en/tutorial01.md b/Documentation~/en/tutorial01.md index 64080abf..621a4e0d 100644 --- a/Documentation~/en/tutorial01.md +++ b/Documentation~/en/tutorial01.md @@ -100,29 +100,29 @@ chart.SetSize(580, 300);//代码动态设置尺寸,或直接操作chart.rectTr 设置标题: ```C# -var title = chart.GetOrAddChartComponent(); +var title = chart.EnsureChartComponent<Title>(); title.text = "Simple Line"; ``` 设置提示框和图例是否显示: ```C# -var tooltip = chart.GetOrAddChartComponent<Tooltip>(); +var tooltip = chart.EnsureChartComponent<Tooltip>(); tooltip.show = true; -var legend = chart.GetOrAddChartComponent<Legend>(); +var legend = chart.EnsureChartComponent<Legend>(); legend.show = false; ``` 设置坐标轴: ```C# -var xAxis = chart.GetOrAddChartComponent<XAxis>(); +var xAxis = chart.EnsureChartComponent<XAxis>(); xAxis.splitNumber = 10; xAxis.boundaryGap = true; xAxis.type = Axis.AxisType.Category; -var yAxis = chart.GetOrAddChartComponent<YAxis>(); +var yAxis = chart.EnsureChartComponent<YAxis>(); yAxis.type = Axis.AxisType.Value; ``` @@ -195,11 +195,11 @@ XCharts支持TextMeshPro,但默认是不开启的,需要自己手动切换 需要先获取组件,再修改里面的参数: ```C# -var title = chart.GetOrAddChartComponent<Title>(); +var title = chart.EnsureChartComponent<Title>(); title.text = "Simple LineChart"; title.subText = "normal line"; -var xAxis = chart.GetOrAddChartComponent<XAxis>(); +var xAxis = chart.EnsureChartComponent<XAxis>(); xAxis.splitNumber = 10; xAxis.boundaryGap = true; xAxis.type = Axis.AxisType.Category; @@ -234,9 +234,9 @@ serie.roundCap = true; 给Serie添加额外组件: ```C# -serie.AddExtraComponent<AreaStyle>(); +serie.EnsureComponent<AreaStyle>(); -var label = serie1.AddExtraComponent<LabelStyle>(); +var label = serie1.EnsureComponent<LabelStyle>(); label.offset = new Vector3(0,20,0); ``` @@ -247,7 +247,7 @@ var serieData = chart.AddData(0, 20); //var serieData = serie.GetSerieData(0); //从已有数据中获取 serieData.radius = 10; -var itemStyle = serieData.GetOrAddComponent<ItemStyle>(); //给数据项添加ItemStyle组件 +var itemStyle = serieData.EnsureComponent<ItemStyle>(); //给数据项添加ItemStyle组件 itemStyle.color = Color.blue; ``` diff --git a/Documentation~/zh/api.md b/Documentation~/zh/api.md index 50828bf4..0b1b60b7 100644 --- a/Documentation~/zh/api.md +++ b/Documentation~/zh/api.md @@ -1,5 +1,5 @@ --- -sidebar_position: 3 +sidebar_position: 41 slug: /api --- @@ -7,48 +7,111 @@ slug: /api ## 所有类 -|||| -|--|--|--| -|[AnimationStyleHelper](#animationstylehelper)|[AxisContext](#axiscontext)|[AxisHandler<T>](#axishandlert)| -|[AxisHelper](#axishelper)|[BarChart](#barchart)|[BaseChart](#basechart)| -|[BaseGraph](#basegraph)|[CandlestickChart](#candlestickchart)|[ChartCached](#chartcached)| -|[ChartConst](#chartconst)|[ChartDrawer](#chartdrawer)|[ChartHelper](#charthelper)| -|[ChartLabel](#chartlabel)|[ChartObject](#chartobject)|[CheckHelper](#checkhelper)| -|[ColorUtil](#colorutil)|[ComponentHandlerAttribute](#componenthandlerattribute)|[ComponentHelper](#componenthelper)| -|[CoordOptionsAttribute](#coordoptionsattribute)|[DataZoomContext](#datazoomcontext)|[DataZoomHelper](#datazoomhelper)| -|[DateTimeUtil](#datetimeutil)|[DefaultAnimationAttribute](#defaultanimationattribute)|[DefineSymbolsUtil](#definesymbolsutil)| -|[FormatterHelper](#formatterhelper)|[GridCoordContext](#gridcoordcontext)|[HeatmapChart](#heatmapchart)| -|[IgnoreDoc](#ignoredoc)|[InteractData](#interactdata)|[LayerHelper](#layerhelper)| -|[LegendContext](#legendcontext)|[LegendHelper](#legendhelper)|[LegendItem](#legenditem)| -|[LineChart](#linechart)|[ListFor](#listfor)|[ListForComponent](#listforcomponent)| -|[ListForSerie](#listforserie)|[MainComponentContext](#maincomponentcontext)|[MainComponentHandler](#maincomponenthandler)| -|[MainComponentHandler<T>](#maincomponenthandlert)|[MathUtil](#mathutil)|[Painter](#painter)| -|[ParallelChart](#parallelchart)|[ParallelCoordContext](#parallelcoordcontext)|[PieChart](#piechart)| -|[PolarChart](#polarchart)|[PolarCoordContext](#polarcoordcontext)|[ProgressBar](#progressbar)| -|[PropertyUtil](#propertyutil)|[RadarChart](#radarchart)|[RadarCoordContext](#radarcoordcontext)| -|[ReflectionUtil](#reflectionutil)|[RequireChartComponentAttribute](#requirechartcomponentattribute)|[RingChart](#ringchart)| -|[RuntimeUtil](#runtimeutil)|[ScatterChart](#scatterchart)|[SerieContext](#seriecontext)| -|[SerieConvertAttribute](#serieconvertattribute)|[SerieDataContext](#seriedatacontext)|[SerieDataExtraComponentAttribute](#seriedataextracomponentattribute)| -|[SerieDataExtraFieldAttribute](#seriedataextrafieldattribute)|[SerieExtraComponentAttribute](#serieextracomponentattribute)|[SerieHandler](#seriehandler)| -|[SerieHandler<T>](#seriehandlert)|[SerieHandlerAttribute](#seriehandlerattribute)|[SerieHelper](#seriehelper)| -|[SerieLabelHelper](#serielabelhelper)|[SerieLabelPool](#serielabelpool)|[SerieParams](#serieparams)| -|[SeriesHelper](#serieshelper)|[SimplifiedBarChart](#simplifiedbarchart)|[SimplifiedCandlestickChart](#simplifiedcandlestickchart)| -|[SimplifiedLineChart](#simplifiedlinechart)|[Since](#since)|[SVG](#svg)| -|[SVGImage](#svgimage)|[SVGPath](#svgpath)|[SVGPathSeg](#svgpathseg)| -|[TooltipContext](#tooltipcontext)|[TooltipData](#tooltipdata)|[TooltipHelper](#tooltiphelper)| -|[TooltipView](#tooltipview)|[TooltipViewItem](#tooltipviewitem)|[UGL](#ugl)| -|[UGLExample](#uglexample)|[UGLHelper](#uglhelper)|[VisualMapContext](#visualmapcontext)| -|[VisualMapHelper](#visualmaphelper)|[XChartsMgr](#xchartsmgr)|[XCResourceImporterWindow](#xcresourceimporterwindow)| -|[XCThemeMgr](#xcthememgr)| +- [AnimationStyleHelper](#animationstylehelper) +- [AxisContext](#axiscontext) +- [AxisHandler<T>](#axishandlert) +- [AxisHelper](#axishelper) +- [BarChart](#barchart) +- [BaseChart](#basechart) +- [BaseGraph](#basegraph) +- [CandlestickChart](#candlestickchart) +- [ChartCached](#chartcached) +- [ChartConst](#chartconst) +- [ChartDrawer](#chartdrawer) +- [ChartHelper](#charthelper) +- [ChartLabel](#chartlabel) +- [ChartObject](#chartobject) +- [CheckHelper](#checkhelper) +- [ColorUtil](#colorutil) +- [ComponentHandlerAttribute](#componenthandlerattribute) +- [ComponentHelper](#componenthelper) +- [CoordOptionsAttribute](#coordoptionsattribute) +- [DataZoomContext](#datazoomcontext) +- [DataZoomHelper](#datazoomhelper) +- [DateTimeUtil](#datetimeutil) +- [DefaultAnimationAttribute](#defaultanimationattribute) +- [DefineSymbolsUtil](#definesymbolsutil) +- [FormatterHelper](#formatterhelper) +- [GridCoordContext](#gridcoordcontext) +- [HeatmapChart](#heatmapchart) +- [IgnoreDoc](#ignoredoc) +- [InputHelper](#inputhelper) +- [InteractData](#interactdata) +- [LayerHelper](#layerhelper) +- [LegendContext](#legendcontext) +- [LegendHelper](#legendhelper) +- [LegendItem](#legenditem) +- [LineChart](#linechart) +- [ListFor](#listfor) +- [ListForComponent](#listforcomponent) +- [ListForSerie](#listforserie) +- [MainComponentContext](#maincomponentcontext) +- [MainComponentHandler](#maincomponenthandler) +- [MainComponentHandler<T>](#maincomponenthandlert) +- [MathUtil](#mathutil) +- [Painter](#painter) +- [ParallelChart](#parallelchart) +- [ParallelCoordContext](#parallelcoordcontext) +- [PieChart](#piechart) +- [PolarChart](#polarchart) +- [PolarCoordContext](#polarcoordcontext) +- [PropertyUtil](#propertyutil) +- [RadarChart](#radarchart) +- [RadarCoordContext](#radarcoordcontext) +- [ReflectionUtil](#reflectionutil) +- [RequireChartComponentAttribute](#requirechartcomponentattribute) +- [RingChart](#ringchart) +- [RuntimeUtil](#runtimeutil) +- [ScatterChart](#scatterchart) +- [SerieComponentAttribute](#seriecomponentattribute) +- [SerieContext](#seriecontext) +- [SerieConvertAttribute](#serieconvertattribute) +- [SerieDataComponentAttribute](#seriedatacomponentattribute) +- [SerieDataContext](#seriedatacontext) +- [SerieDataExtraFieldAttribute](#seriedataextrafieldattribute) +- [SerieEventData](#serieeventdata) +- [SerieEventDataPool](#serieeventdatapool) +- [SerieHandler](#seriehandler) +- [SerieHandler<T>](#seriehandlert) +- [SerieHandlerAttribute](#seriehandlerattribute) +- [SerieHelper](#seriehelper) +- [SerieLabelHelper](#serielabelhelper) +- [SerieLabelPool](#serielabelpool) +- [SerieParams](#serieparams) +- [SeriesHelper](#serieshelper) +- [SimplifiedBarChart](#simplifiedbarchart) +- [SimplifiedCandlestickChart](#simplifiedcandlestickchart) +- [SimplifiedLineChart](#simplifiedlinechart) +- [Since](#since) +- [SVG](#svg) +- [SVGImage](#svgimage) +- [SVGPath](#svgpath) +- [SVGPathSeg](#svgpathseg) +- [TooltipContext](#tooltipcontext) +- [TooltipData](#tooltipdata) +- [TooltipHelper](#tooltiphelper) +- [TooltipView](#tooltipview) +- [TooltipViewItem](#tooltipviewitem) +- [UGL](#ugl) +- [UGLExample](#uglexample) +- [UGLHelper](#uglhelper) +- [UIComponent](#uicomponent) +- [UIHelper](#uihelper) +- [VisualMapContext](#visualmapcontext) +- [VisualMapHelper](#visualmaphelper) +- [XChartsMgr](#xchartsmgr) +- [XCResourceImporterWindow](#xcresourceimporterwindow) +- [XCThemeMgr](#xcthememgr) + ## AnimationStyleHelper -|public method|description| -|--|--| -| CheckDataAnimation() |public static float CheckDataAnimation(BaseChart chart, Serie serie, int dataIndex, float destProgress, float startPorgress = 0)| -| GetAnimationPosition() |public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)| -| UpdateAnimationType() |public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType)| -| UpdateSerieAnimation() |public static void UpdateSerieAnimation(Serie serie)| +|public method|since|description| +|--|--|--| +|CheckDataAnimation()||public static float CheckDataAnimation(BaseChart chart, Serie serie, int dataIndex, float destProgress, float startPorgress = 0)| +|GetAnimationPosition()||public static bool GetAnimationPosition(AnimationStyle animation, bool isY, Vector3 lp, Vector3 cp, float progress, ref Vector3 ip)| +|UpdateAnimationType()||public static void UpdateAnimationType(AnimationStyle animation, AnimationType defaultType)| +|UpdateSerieAnimation()||public static void UpdateSerieAnimation(Serie serie)| ## AxisContext @@ -60,29 +123,29 @@ Inherits or Implemented: [MainComponentHandler](#maincomponenthandler) ## AxisHelper -|public method|description| -|--|--| -| AdjustCircleLabelPos() |public static void AdjustCircleLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)| -| AdjustMinMaxValue() |public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, double ceilRate = 0)<br/>调整最大最小值 | -| AdjustRadiusAxisLabelPos() |public static void AdjustRadiusAxisLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)| -| GetAxisLineArrowOffset() |public static float GetAxisLineArrowOffset(Axis axis)<br/>包含箭头偏移的轴线长度 | -| GetAxisPosition() |public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)| -| GetAxisPositionValue() |public static double GetAxisPositionValue(float xy, float axisLength, double axisRange, float axisStart, float axisOffset)| -| GetAxisPositionValue() |public static double GetAxisPositionValue(GridCoord grid, Axis axis, Vector3 pos)| -| GetAxisValueDistance() |public static float GetAxisValueDistance(GridCoord grid, Axis axis, float scaleWidth, double value)<br/>获得数值value在坐标轴上相对起点的距离 | -| GetAxisValueLength() |public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value)<br/>获得数值value在坐标轴上对应的长度 | -| GetAxisValuePosition() |public static float GetAxisValuePosition(GridCoord grid, Axis axis, float scaleWidth, double value)<br/>获得数值value在坐标轴上的坐标位置 | -| GetAxisValueSplitIndex() |public static int GetAxisValueSplitIndex(Axis axis, double value, int totalSplitNumber = -1)<br/>获得数值value在坐标轴上对应的split索引 | -| GetAxisXOrY() |public static float GetAxisXOrY(GridCoord grid, Axis axis, Axis relativedAxis)| -| GetDataWidth() |public static float GetDataWidth(Axis axis, float coordinateWidth, int dataCount, DataZoom dataZoom)<br/>获得一个类目数据在坐标系中代表的宽度 | -| GetEachWidth() |public static float GetEachWidth(Axis axis, float coordinateWidth, DataZoom dataZoom = null)| -| GetScaleNumber() |public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)<br/>获得分割线条数 | -| GetScaleWidth() |public static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)<br/>获得分割段宽度 | -| GetSplitNumber() |public static int GetSplitNumber(Axis axis, float coordinateWid, DataZoom dataZoom)<br/>获得分割段数 | -| GetTotalSplitGridNum() |public static int GetTotalSplitGridNum(Axis axis)<br/>获得分割网格个数,包含次刻度 | -| GetXAxisXOrY() |public static float GetXAxisXOrY(GridCoord grid, Axis xAxis, Axis relativedAxis)| -| GetYAxisXOrY() |public static float GetYAxisXOrY(GridCoord grid, Axis yAxis, Axis relativedAxis)| -| NeedShowSplit() |public static bool NeedShowSplit(Axis axis)| +|public method|since|description| +|--|--|--| +|AdjustCircleLabelPos()||public static void AdjustCircleLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)| +|AdjustMinMaxValue()||public static void AdjustMinMaxValue(Axis axis, ref double minValue, ref double maxValue, bool needFormat, double ceilRate = 0)<br/>调整最大最小值 | +|AdjustRadiusAxisLabelPos()||public static void AdjustRadiusAxisLabelPos(ChartLabel txt, Vector3 pos, Vector3 cenPos, float txtHig, Vector3 offset)| +|GetAxisLineArrowOffset()||public static float GetAxisLineArrowOffset(Axis axis)<br/>包含箭头偏移的轴线长度 | +|GetAxisPosition()||public static float GetAxisPosition(GridCoord grid, Axis axis, double value, int dataCount = 0, DataZoom dataZoom = null)| +|GetAxisPositionValue()||public static double GetAxisPositionValue(float xy, float axisLength, double axisRange, float axisStart, float axisOffset)| +|GetAxisPositionValue()||public static double GetAxisPositionValue(GridCoord grid, Axis axis, Vector3 pos)| +|GetAxisValueDistance()||public static float GetAxisValueDistance(GridCoord grid, Axis axis, float scaleWidth, double value)<br/>获得数值value在坐标轴上相对起点的距离 | +|GetAxisValueLength()||public static float GetAxisValueLength(GridCoord grid, Axis axis, float scaleWidth, double value)<br/>获得数值value在坐标轴上对应的长度 | +|GetAxisValuePosition()||public static float GetAxisValuePosition(GridCoord grid, Axis axis, float scaleWidth, double value)<br/>获得数值value在坐标轴上的坐标位置 | +|GetAxisValueSplitIndex()||public static int GetAxisValueSplitIndex(Axis axis, double value, int totalSplitNumber = -1)<br/>获得数值value在坐标轴上对应的split索引 | +|GetAxisXOrY()||public static float GetAxisXOrY(GridCoord grid, Axis axis, Axis relativedAxis)| +|GetDataWidth()||public static float GetDataWidth(Axis axis, float coordinateWidth, int dataCount, DataZoom dataZoom)<br/>获得一个类目数据在坐标系中代表的宽度 | +|GetEachWidth()||public static float GetEachWidth(Axis axis, float coordinateWidth, DataZoom dataZoom = null)| +|GetScaleNumber()||public static int GetScaleNumber(Axis axis, float coordinateWidth, DataZoom dataZoom = null)<br/>获得分割线条数 | +|GetScaleWidth()||public static float GetScaleWidth(Axis axis, float coordinateWidth, int index, DataZoom dataZoom = null)<br/>获得分割段宽度 | +|GetSplitNumber()||public static int GetSplitNumber(Axis axis, float coordinateWid, DataZoom dataZoom)<br/>获得分割段数 | +|GetTotalSplitGridNum()||public static int GetTotalSplitGridNum(Axis axis)<br/>获得分割网格个数,包含次刻度 | +|GetXAxisXOrY()||public static float GetXAxisXOrY(GridCoord grid, Axis xAxis, Axis relativedAxis)| +|GetYAxisXOrY()||public static float GetYAxisXOrY(GridCoord grid, Axis yAxis, Axis relativedAxis)| +|NeedShowSplit()||public static bool NeedShowSplit(Axis axis)| ## BarChart @@ -92,194 +155,222 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [BaseGraph](#basegraph),[ISerializationCallbackReceiver](#iserializationcallbackreceiver) -|public method|description| -|--|--| -| AddChartComponent() |public MainComponent AddChartComponent(Type type)| -| AddChartComponent<T>() |public T AddChartComponent<T>() where T : MainComponent| -| AddChartComponentWhenNoExist<T>() |public T AddChartComponentWhenNoExist<T>() where T : MainComponent| -| AddData() |public SerieData AddData(int serieIndex, DateTime time, double yValue, string dataName = null, string dataId = null)<br/>添加(time,y)数据到指定的系列中。 | -| AddData() |public SerieData AddData(int serieIndex, double data, string dataName = null, string dataId = null)<br/>添加一个数据到指定的系列中。 | -| AddData() |public SerieData AddData(int serieIndex, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)| -| AddData() |public SerieData AddData(int serieIndex, double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到指定系列中。 | -| AddData() |public SerieData AddData(int serieIndex, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>添加多维数据(x,y,z...)到指定的系列中。 | -| AddData() |public SerieData AddData(int serieIndex, params double[] multidimensionalData)<br/>添加多维数据(x,y,z...)到指定的系列中。 | -| AddData() |public SerieData AddData(string serieName, DateTime time, double yValue, string dataName = null, string dataId = null)<br/>添加(time,y)数据到指定的系列中。 | -| AddData() |public SerieData AddData(string serieName, double data, string dataName = null, string dataId = null)<br/>If serieName doesn't exist in legend,will be add to legend. | -| AddData() |public SerieData AddData(string serieName, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)| -| AddData() |public SerieData AddData(string serieName, double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到指定系列中。 | -| AddData() |public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>添加多维数据(x,y,z...)到指定的系列中。 | -| AddData() |public SerieData AddData(string serieName, params double[] multidimensionalData)<br/>添加多维数据(x,y,z...)到指定的系列中。 | -| AddSerie<T>() |public T AddSerie<T>(string serieName = null, bool show = true, bool addToHead = false) where T : Serie| -| AddXAxisData() |public void AddXAxisData(string category, int xAxisIndex = 0)<br/>添加一个类目数据到指定的x轴。 | -| AddXAxisIcon() |public void AddXAxisIcon(Sprite icon, int xAxisIndex = 0)<br/>添加一个图标到指定的x轴。 | -| AddYAxisData() |public void AddYAxisData(string category, int yAxisIndex = 0)<br/>添加一个类目数据到指定的y轴。 | -| AddYAxisIcon() |public void AddYAxisIcon(Sprite icon, int yAxisIndex = 0)<br/>添加一个图标到指定的y轴。 | -| AnimationEnable() |public void AnimationEnable(bool flag)<br/>启用或关闭起始动画。 | -| AnimationFadeIn() |public void AnimationFadeIn(bool reset = true)<br/>开始渐入动画。 | -| AnimationFadeOut() |public void AnimationFadeOut()<br/>开始渐出动画。 | -| AnimationPause() |public void AnimationPause()<br/>暂停动画。 | -| AnimationReset() |public void AnimationReset()<br/>重置动画。 | -| AnimationResume() |public void AnimationResume()<br/>继续动画。 | -| CanAddChartComponent() |public bool CanAddChartComponent(Type type)| -| CanAddSerie() |public bool CanAddSerie(Type type)| -| CanAddSerie<T>() |public bool CanAddSerie<T>() where T : Serie| -| CanMultipleComponent() |public bool CanMultipleComponent(Type type)| -| ClampInChart() |public void ClampInChart(ref Vector3 pos)| -| ClampInGrid() |public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)| -| ClearComponentData() |public virtual void ClearComponentData()<br/>清空所有组件的数据。 | -| ClearData() |public virtual void ClearData()<br/>清空所有组件和Serie的数据。注意:Serie只是清空数据,不会移除Serie。 | -| ClearSerieData() |public virtual void ClearSerieData()<br/>清空所有serie的数据。 | -| ClickLegendButton() |public void ClickLegendButton(int legendIndex, string legendName, bool show)<br/>点击图例按钮 | -| CovertSerie() |public bool CovertSerie(Serie serie, Type type)| -| CovertSerie<T>() |public bool CovertSerie<T>(Serie serie) where T : Serie| -| CovertXYAxis() |public void CovertXYAxis(int index)<br/>转换X轴和Y轴的配置 | -| GenerateDefaultSerieName() |public string GenerateDefaultSerieName()| -| GetAllSerieDataCount() |public int GetAllSerieDataCount()| -| GetChartBackgroundColor() |public Color32 GetChartBackgroundColor()| -| GetChartComponent<T>() |public T GetChartComponent<T>(int index = 0) where T : MainComponent| -| GetChartComponentNum() |public int GetChartComponentNum(Type type)| -| GetChartComponentNum<T>() |public int GetChartComponentNum<T>() where T : MainComponent| -| GetChartComponents<T>() |public List<MainComponent> GetChartComponents<T>() where T : MainComponent| -| GetData() |public double GetData(int serieIndex, int dataIndex, int dimension = 1)| -| GetData() |public double GetData(string serieName, int dataIndex, int dimension = 1)| -| GetDataZoomOfAxis() |public DataZoom GetDataZoomOfAxis(Axis axis)| -| GetDataZoomOfSerie() |public void GetDataZoomOfSerie(Serie serie, out DataZoom xDataZoom, out DataZoom yDataZoom)| -| GetGrid() |public GridCoord GetGrid(Vector2 local)| -| GetGridOfDataZoom() |public GridCoord GetGridOfDataZoom(DataZoom dataZoom)| -| GetItemColor() |public Color32 GetItemColor(Serie serie)| -| GetItemColor() |public Color32 GetItemColor(Serie serie, SerieData serieData)| -| GetItemColor() |public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)| -| GetLegendRealShowNameColor() |public Color32 GetLegendRealShowNameColor(string name)| -| GetLegendRealShowNameIndex() |public int GetLegendRealShowNameIndex(string name)| -| GetMarkColor() |public Color32 GetMarkColor(Serie serie, SerieData serieData)<br/>获得Serie的标识颜色。 | -| GetOrAddChartComponent<T>() |public T GetOrAddChartComponent<T>() where T : MainComponent| -| GetPainter() |public Painter GetPainter(int index)| -| GetSerie() |public Serie GetSerie(int serieIndex)| -| GetSerie() |public Serie GetSerie(string serieName)| -| GetSerie<T>() |public T GetSerie<T>() where T : Serie| -| GetSerie<T>() |public T GetSerie<T>(int serieIndex) where T : Serie| -| GetSerieBarGap<T>() |public float GetSerieBarGap<T>() where T : Serie| -| GetSerieBarRealCount<T>() |public int GetSerieBarRealCount<T>() where T : Serie| -| GetSerieIndexIfStack<T>() |public int GetSerieIndexIfStack<T>(Serie currSerie) where T : Serie| -| GetSerieSameStackTotalValue<T>() |public double GetSerieSameStackTotalValue<T>(string stack, int dataIndex) where T : Serie| -| GetSeriesMinMaxValue() |public virtual void GetSeriesMinMaxValue(Axis axis, int axisIndex, out double tempMinValue, out double tempMaxValue)| -| GetSerieTotalGap<T>() |public float GetSerieTotalGap<T>(float categoryWidth, float gap, int index) where T : Serie| -| GetSerieTotalWidth<T>() |public float GetSerieTotalWidth<T>(float categoryWidth, float gap, int realBarCount) where T : Serie| -| GetTitlePosition() |public Vector3 GetTitlePosition(Title title)| -| GetVisualMapOfSerie() |public VisualMap GetVisualMapOfSerie(Serie serie)| -| GetXDataZoomOfSerie() |public DataZoom GetXDataZoomOfSerie(Serie serie)| -| GetXLerpColor() |public Color32 GetXLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, GridCoord grid)| -| GetYLerpColor() |public Color32 GetYLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, GridCoord grid)| -| HasChartComponent() |public bool HasChartComponent(Type type)| -| HasChartComponent<T>() |public bool HasChartComponent<T>()| -| HasSerie() |public bool HasSerie(Type type)| -| HasSerie<T>() |public bool HasSerie<T>() where T : Serie| -| Init() |public void Init(bool defaultChart = true)| -| InitAxisRuntimeData() |public virtual void InitAxisRuntimeData(Axis axis) { }| -| InsertSerie() |public void InsertSerie(Serie serie, int index = -1, bool addToHead = false)| -| InsertSerie<T>() |public T InsertSerie<T>(int index, string serieName = null, bool show = true) where T : Serie| -| Internal_CheckAnimation() |public void Internal_CheckAnimation()| -| IsActiveByLegend() |public virtual bool IsActiveByLegend(string legendName)<br/>获得指定图例名字的系列是否显示。 | -| IsAllAxisCategory() |public bool IsAllAxisCategory()<br/>纯类目轴。 | -| IsAllAxisValue() |public bool IsAllAxisValue()<br/>纯数值坐标轴(数值轴或对数轴)。 | -| IsInAnyGrid() |public bool IsInAnyGrid(Vector2 local)| -| IsInChart() |public bool IsInChart(float x, float y)| -| IsInChart() |public bool IsInChart(Vector2 local)<br/>坐标是否在图表范围内 | -| IsSerieName() |public bool IsSerieName(string name)| -| MoveDownSerie() |public bool MoveDownSerie(int serieIndex)| -| MoveUpSerie() |public bool MoveUpSerie(int serieIndex)| -| OnAfterDeserialize() |public void OnAfterDeserialize()| -| OnBeforeSerialize() |public void OnBeforeSerialize()| -| OnBeginDrag() |public override void OnBeginDrag(PointerEventData eventData)| -| OnDataZoomRangeChanged() |public virtual void OnDataZoomRangeChanged(DataZoom dataZoom)| -| OnDrag() |public override void OnDrag(PointerEventData eventData)| -| OnEndDrag() |public override void OnEndDrag(PointerEventData eventData)| -| OnLegendButtonClick() |public virtual void OnLegendButtonClick(int index, string legendName, bool show)| -| OnLegendButtonEnter() |public virtual void OnLegendButtonEnter(int index, string legendName)| -| OnLegendButtonExit() |public virtual void OnLegendButtonExit(int index, string legendName)| -| OnPointerClick() |public override void OnPointerClick(PointerEventData eventData)| -| OnPointerDown() |public override void OnPointerDown(PointerEventData eventData)| -| OnPointerEnter() |public override void OnPointerEnter(PointerEventData eventData)| -| OnPointerExit() |public override void OnPointerExit(PointerEventData eventData)| -| OnPointerUp() |public override void OnPointerUp(PointerEventData eventData)| -| OnScroll() |public override void OnScroll(PointerEventData eventData)| -| RefreshBasePainter() |public void RefreshBasePainter()| -| RefreshChart() |public void RefreshChart()<br/>在下一帧刷新整个图表。 | -| RefreshChart() |public void RefreshChart(int serieIndex)<br/>在下一帧刷新图表的指定serie。 | -| RefreshChart() |public void RefreshChart(Serie serie)<br/>在下一帧刷新图表的指定serie。 | -| RefreshDataZoom() |public void RefreshDataZoom()<br/>在下一帧刷新DataZoom | -| RefreshGraph() |public override void RefreshGraph()| -| RefreshPainter() |public void RefreshPainter(int index)| -| RefreshPainter() |public void RefreshPainter(Serie serie)| -| RefreshTopPainter() |public void RefreshTopPainter()| -| RefreshUpperPainter() |public void RefreshUpperPainter()| -| RemoveAllChartComponent() |public void RemoveAllChartComponent()| -| RemoveAllSerie() |public virtual void RemoveAllSerie()<br/>移除所有的Serie。当确认只需要移除Serie时使用该接口,其他情况下一般用RemoveData()。 | -| RemoveChartComponent() |public bool RemoveChartComponent(MainComponent component)| -| RemoveChartComponent() |public bool RemoveChartComponent(Type type, int index = 0)| -| RemoveChartComponent<T>() |public bool RemoveChartComponent<T>(int index = 0)| -| RemoveChartComponents() |public int RemoveChartComponents(Type type)| -| RemoveChartComponents<T>() |public int RemoveChartComponents<T>()| -| RemoveData() |public virtual void RemoveData()<br/>清空所有组件数据,并移除所有Serie。一般在图表重新初始化时使用。 注意:组件只清空数据部分,参数会保留不会被重置。 | -| RemoveData() |public virtual void RemoveData(string serieName)<br/>清除指定系列名称的数据。 | -| RemoveSerie() |public void RemoveSerie(int serieIndex)| -| RemoveSerie() |public void RemoveSerie(Serie serie)| -| RemoveSerie() |public void RemoveSerie(string serieName)| -| RemoveSerie<T>() |public void RemoveSerie<T>() where T : Serie| -| ReplaceSerie() |public bool ReplaceSerie(Serie oldSerie, Serie newSerie)| -| ResetDataIndex() |public bool ResetDataIndex(int serieIndex)<br/>重置serie的数据项索引。避免数据项索引异常。 | -| SaveAsImage() |public void SaveAsImage(string imageType = "png", string savePath = "")<br/>保存图表为图片。 | -| SetBasePainterMaterial() |public void SetBasePainterMaterial(Material material)<br/>设置Base Painter的材质球 | -| SetMaxCache() |public void SetMaxCache(int maxCache)<br/>设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 | -| SetPainterActive() |public void SetPainterActive(int index, bool flag)| -| SetSerieActive() |public void SetSerieActive(int serieIndex, bool active)<br/>设置指定系列是否显示。 | -| SetSerieActive() |public void SetSerieActive(Serie serie, bool active)| -| SetSerieActive() |public void SetSerieActive(string serieName, bool active)<br/>设置指定系列是否显示。 | -| SetSeriePainterMaterial() |public void SetSeriePainterMaterial(Material material)<br/>设置Serie Painter的材质球 | -| SetTopPainterMaterial() |public void SetTopPainterMaterial(Material material)<br/>设置Top Painter的材质球 | -| SetUpperPainterMaterial() |public void SetUpperPainterMaterial(Material material)<br/>设置Upper Painter的材质球 | -| TryAddChartComponent() |public bool TryAddChartComponent(Type type)| -| TryAddChartComponent<T>() |public bool TryAddChartComponent<T>() where T : MainComponent| -| TryAddChartComponent<T>() |public bool TryAddChartComponent<T>(out T component) where T : MainComponent| -| TryGetChartComponent<T>() |public bool TryGetChartComponent<T>(out T component, int index = 0)| -| UpdateData() |public bool UpdateData(int serieIndex, int dataIndex, double value)<br/>更新指定系列中的指定索引数据。 | -| UpdateData() |public bool UpdateData(int serieIndex, int dataIndex, int dimension, double value)<br/>更新指定系列指定索引指定维数的数据。维数从0开始。 | -| UpdateData() |public bool UpdateData(int serieIndex, int dataIndex, List<double> multidimensionalData)<br/>更新指定系列指定索引的数据项的多维数据。 | -| UpdateData() |public bool UpdateData(string serieName, int dataIndex, double value)<br/>更新指定系列中的指定索引数据。 | -| UpdateData() |public bool UpdateData(string serieName, int dataIndex, int dimension, double value)<br/>更新指定系列指定索引指定维数的数据。维数从0开始。 | -| UpdateData() |public bool UpdateData(string serieName, int dataIndex, List<double> multidimensionalData)<br/>更新指定系列指定索引的数据项的多维数据。 | -| UpdateDataName() |public bool UpdateDataName(int serieIndex, int dataIndex, string dataName)<br/>更新指定系列中的指定索引数据名称。 | -| UpdateDataName() |public bool UpdateDataName(string serieName, int dataIndex, string dataName)<br/>更新指定系列中的指定索引数据名称。 | -| UpdateLegendColor() |public virtual void UpdateLegendColor(string legendName, bool active)| -| UpdateTheme() |public bool UpdateTheme(ThemeType theme)<br/>切换内置主题。 | -| UpdateTheme() |public void UpdateTheme(Theme theme)<br/>切换图表主题。 | -| UpdateXAxisData() |public void UpdateXAxisData(int index, string category, int xAxisIndex = 0)<br/>更新X轴类目数据。 | -| UpdateXAxisIcon() |public void UpdateXAxisIcon(int index, Sprite icon, int xAxisIndex = 0)<br/>更新X轴图标。 | -| UpdateYAxisData() |public void UpdateYAxisData(int index, string category, int yAxisIndex = 0)<br/>更新Y轴类目数据。 | -| UpdateYAxisIcon() |public void UpdateYAxisIcon(int index, Sprite icon, int yAxisIndex = 0)<br/>更新Y轴图标。 | +|public method|since|description| +|--|--|--| +|onAxisPointerValueChanged||public Action<Axis, double> onAxisPointerValueChanged<br/>坐标轴变更数据索引时回调。参数:axis, dataIndex/dataValue | +|onDraw||public Action<VertexHelper> onDraw<br/>自定义绘制回调。在绘制Serie前调用。 | +|onDrawAfterSerie||public Action<VertexHelper, Serie> onDrawAfterSerie<br/>自定义Serie绘制回调。在每个Serie绘制完后调用。 | +|onDrawBeforeSerie||public Action<VertexHelper, Serie> onDrawBeforeSerie<br/>自定义Serie绘制回调。在每个Serie绘制完前调用。 | +|onDrawTop||public Action<VertexHelper> onDrawTop<br/>自定义Top层绘制回调。在绘制Tooltip前调用。 | +|onDrawUpper||public Action<VertexHelper> onDrawUpper<br/>自定义Upper层绘制回调。在绘制Tooltip前调用。 | +|onInit||public Action onInit<br/>图表的初始化完成回调。 | +|onLegendClick||public Action<Legend, int, string, bool> onLegendClick<br/>点击图例按钮回调。参数:legendIndex, legendName, show | +|onLegendEnter||public Action<Legend, int, string> onLegendEnter<br/>鼠标进入图例回调。参数:legendIndex, legendName | +|onLegendExit||public Action<Legend, int, string> onLegendExit<br/>鼠标退出图例回调。参数:legendIndex, legendName | +|onPointerClickBar||public Action<PointerEventData, int> onPointerClickBar<br/>点击柱形图柱条回调。参数:eventData, dataIndex | +|onPointerClickPie||public Action<PointerEventData, int, int> onPointerClickPie<br/>点击饼图区域回调。参数:PointerEventData,SerieIndex,SerieDataIndex | +|onPointerEnterPie||public Action<int, int> onPointerEnterPie<br/>鼠标进入和离开饼图区域回调,SerieDataIndex为-1时表示离开。参数:PointerEventData,SerieIndex,SerieDataIndex | +|onSerieClick|v3.6.0|public Action<SerieEventData> onSerieClick<br/>鼠标点击Serie回调。 | +|onSerieDown|v3.6.0|public Action<SerieEventData> onSerieDown<br/>鼠标按下Serie回调。 | +|onSerieEnter|v3.6.0|public Action<SerieEventData> onSerieEnter<br/>鼠标进入Serie回调。 | +|onSerieExit|v3.6.0|public Action<SerieEventData> onSerieExit<br/>鼠标离开Serie回调。 | +|onUpdate||public Action onUpdate<br/>图表的Update回调。 | +|AddChartComponent()||public MainComponent AddChartComponent(Type type)| +|AddChartComponent<T>()||public T AddChartComponent<T>() where T : MainComponent| +|AddChartComponentWhenNoExist<T>()||public T AddChartComponentWhenNoExist<T>() where T : MainComponent| +|AddData()||public SerieData AddData(int serieIndex, DateTime time, double yValue, string dataName = null, string dataId = null)<br/>添加(time,y)数据到指定的系列中。 | +|AddData()||public SerieData AddData(int serieIndex, double data, string dataName = null, string dataId = null)<br/>添加一个数据到指定的系列中。 | +|AddData()||public SerieData AddData(int serieIndex, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)| +|AddData()||public SerieData AddData(int serieIndex, double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到指定系列中。 | +|AddData()||public SerieData AddData(int serieIndex, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>添加多维数据(x,y,z...)到指定的系列中。 | +|AddData()||public SerieData AddData(int serieIndex, params double[] multidimensionalData)<br/>添加多维数据(x,y,z...)到指定的系列中。 | +|AddData()||public SerieData AddData(string serieName, DateTime time, double yValue, string dataName = null, string dataId = null)<br/>添加(time,y)数据到指定的系列中。 | +|AddData()||public SerieData AddData(string serieName, double data, string dataName = null, string dataId = null)<br/>If serieName doesn't exist in legend,will be add to legend. | +|AddData()||public SerieData AddData(string serieName, double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)| +|AddData()||public SerieData AddData(string serieName, double xValue, double yValue, string dataName = null, string dataId = null)<br/>添加(x,y)数据到指定系列中。 | +|AddData()||public SerieData AddData(string serieName, List<double> multidimensionalData, string dataName = null, string dataId = null)<br/>添加多维数据(x,y,z...)到指定的系列中。 | +|AddData()||public SerieData AddData(string serieName, params double[] multidimensionalData)<br/>添加多维数据(x,y,z...)到指定的系列中。 | +|AddSerie<T>()||public T AddSerie<T>(string serieName = null, bool show = true, bool addToHead = false) where T : Serie| +|AddXAxisData()||public void AddXAxisData(string category, int xAxisIndex = 0)<br/>添加一个类目数据到指定的x轴。 | +|AddXAxisIcon()||public void AddXAxisIcon(Sprite icon, int xAxisIndex = 0)<br/>添加一个图标到指定的x轴。 | +|AddYAxisData()||public void AddYAxisData(string category, int yAxisIndex = 0)<br/>添加一个类目数据到指定的y轴。 | +|AddYAxisIcon()||public void AddYAxisIcon(Sprite icon, int yAxisIndex = 0)<br/>添加一个图标到指定的y轴。 | +|AnimationEnable()||public void AnimationEnable(bool flag)<br/>启用或关闭起始动画。 | +|AnimationFadeIn()||public void AnimationFadeIn(bool reset = true)<br/>开始渐入动画。 | +|AnimationFadeOut()||public void AnimationFadeOut()<br/>开始渐出动画。 | +|AnimationPause()||public void AnimationPause()<br/>暂停动画。 | +|AnimationReset()||public void AnimationReset()<br/>重置动画。 | +|AnimationResume()||public void AnimationResume()<br/>继续动画。 | +|CanAddChartComponent()||public bool CanAddChartComponent(Type type)| +|CanAddSerie()||public bool CanAddSerie(Type type)| +|CanAddSerie<T>()||public bool CanAddSerie<T>() where T : Serie| +|CanMultipleComponent()||public bool CanMultipleComponent(Type type)| +|ClampInChart()||public void ClampInChart(ref Vector3 pos)| +|ClampInGrid()||public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)| +|ClearComponentData()||public virtual void ClearComponentData()<br/>清空所有组件的数据。 | +|ClearData()||public virtual void ClearData()<br/>清空所有组件和Serie的数据。注意:Serie只是清空数据,不会移除Serie。 | +|ClearSerieData()||public virtual void ClearSerieData()<br/>清空所有serie的数据。 | +|ClickLegendButton()||public void ClickLegendButton(int legendIndex, string legendName, bool show)<br/>点击图例按钮 | +|ConvertSerie()||public bool ConvertSerie(Serie serie, Type type)| +|ConvertSerie<T>()||public bool ConvertSerie<T>(Serie serie) where T : Serie| +|ConvertXYAxis()||public void ConvertXYAxis(int index)<br/>转换X轴和Y轴的配置 | +|EnsureChartComponent<T>()|v3.6.0|public T EnsureChartComponent<T>() where T : MainComponent<br/>确保图表有该组件,如果没有则添加。注意:有可能添加不成功。 | +|GenerateDefaultSerieName()||public string GenerateDefaultSerieName()| +|GetAllSerieDataCount()||public int GetAllSerieDataCount()| +|GetChartBackgroundColor()||public Color32 GetChartBackgroundColor()| +|GetChartComponent<T>()||public T GetChartComponent<T>(int index = 0) where T : MainComponent| +|GetChartComponentNum()||public int GetChartComponentNum(Type type)| +|GetChartComponentNum<T>()||public int GetChartComponentNum<T>() where T : MainComponent| +|GetChartComponents<T>()||public List<MainComponent> GetChartComponents<T>() where T : MainComponent| +|GetData()||public double GetData(int serieIndex, int dataIndex, int dimension = 1)| +|GetData()||public double GetData(string serieName, int dataIndex, int dimension = 1)| +|GetDataZoomOfAxis()||public DataZoom GetDataZoomOfAxis(Axis axis)| +|GetDataZoomOfSerie()||public void GetDataZoomOfSerie(Serie serie, out DataZoom xDataZoom, out DataZoom yDataZoom)| +|GetGrid()||public GridCoord GetGrid(Vector2 local)| +|GetGridOfDataZoom()||public GridCoord GetGridOfDataZoom(DataZoom dataZoom)| +|GetItemColor()||public Color32 GetItemColor(Serie serie)| +|GetItemColor()||public Color32 GetItemColor(Serie serie, SerieData serieData)| +|GetItemColor()||public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)| +|GetLegendRealShowNameColor()||public Color32 GetLegendRealShowNameColor(string name)| +|GetLegendRealShowNameIndex()||public int GetLegendRealShowNameIndex(string name)| +|GetMarkColor()||public Color32 GetMarkColor(Serie serie, SerieData serieData)<br/>获得Serie的标识颜色。 | +|GetOrAddChartComponent<T>()||public T GetOrAddChartComponent<T>() where T : MainComponent| +|GetPainter()||public Painter GetPainter(int index)| +|GetSerie()||public Serie GetSerie(int serieIndex)| +|GetSerie()||public Serie GetSerie(string serieName)| +|GetSerie<T>()||public T GetSerie<T>() where T : Serie| +|GetSerie<T>()||public T GetSerie<T>(int serieIndex) where T : Serie| +|GetSerieBarGap<T>()||public float GetSerieBarGap<T>() where T : Serie| +|GetSerieBarRealCount<T>()||public int GetSerieBarRealCount<T>() where T : Serie| +|GetSerieIndexIfStack<T>()||public int GetSerieIndexIfStack<T>(Serie currSerie) where T : Serie| +|GetSerieSameStackTotalValue<T>()||public double GetSerieSameStackTotalValue<T>(string stack, int dataIndex) where T : Serie| +|GetSeriesMinMaxValue()||public virtual void GetSeriesMinMaxValue(Axis axis, int axisIndex, out double tempMinValue, out double tempMaxValue)| +|GetSerieTotalGap<T>()||public float GetSerieTotalGap<T>(float categoryWidth, float gap, int index) where T : Serie| +|GetSerieTotalWidth<T>()||public float GetSerieTotalWidth<T>(float categoryWidth, float gap, int realBarCount) where T : Serie| +|GetTitlePosition()||public Vector3 GetTitlePosition(Title title)| +|GetVisualMapOfSerie()||public VisualMap GetVisualMapOfSerie(Serie serie)| +|GetXDataZoomOfSerie()||public DataZoom GetXDataZoomOfSerie(Serie serie)| +|GetXLerpColor()||public Color32 GetXLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, GridCoord grid)| +|GetYLerpColor()||public Color32 GetYLerpColor(Color32 areaColor, Color32 areaToColor, Vector3 pos, GridCoord grid)| +|HasChartComponent()||public bool HasChartComponent(Type type)| +|HasChartComponent<T>()||public bool HasChartComponent<T>()| +|HasSerie()||public bool HasSerie(Type type)| +|HasSerie<T>()||public bool HasSerie<T>() where T : Serie| +|Init()||public void Init(bool defaultChart = true)| +|InitAxisRuntimeData()||public virtual void InitAxisRuntimeData(Axis axis) { }| +|InsertSerie()||public void InsertSerie(Serie serie, int index = -1, bool addToHead = false)| +|InsertSerie<T>()||public T InsertSerie<T>(int index, string serieName = null, bool show = true) where T : Serie| +|Internal_CheckAnimation()||public void Internal_CheckAnimation()| +|IsActiveByLegend()||public virtual bool IsActiveByLegend(string legendName)<br/>获得指定图例名字的系列是否显示。 | +|IsAllAxisCategory()||public bool IsAllAxisCategory()<br/>纯类目轴。 | +|IsAllAxisValue()||public bool IsAllAxisValue()<br/>纯数值坐标轴(数值轴或对数轴)。 | +|IsInAnyGrid()||public bool IsInAnyGrid(Vector2 local)| +|IsInChart()||public bool IsInChart(float x, float y)| +|IsInChart()||public bool IsInChart(Vector2 local)<br/>坐标是否在图表范围内 | +|IsSerieName()||public bool IsSerieName(string name)| +|MoveDownSerie()||public bool MoveDownSerie(int serieIndex)| +|MoveUpSerie()||public bool MoveUpSerie(int serieIndex)| +|OnAfterDeserialize()||public void OnAfterDeserialize()| +|OnBeforeSerialize()||public void OnBeforeSerialize()| +|OnBeginDrag()||public override void OnBeginDrag(PointerEventData eventData)| +|OnDataZoomRangeChanged()||public virtual void OnDataZoomRangeChanged(DataZoom dataZoom)| +|OnDrag()||public override void OnDrag(PointerEventData eventData)| +|OnEndDrag()||public override void OnEndDrag(PointerEventData eventData)| +|OnLegendButtonClick()||public virtual void OnLegendButtonClick(int index, string legendName, bool show)| +|OnLegendButtonEnter()||public virtual void OnLegendButtonEnter(int index, string legendName)| +|OnLegendButtonExit()||public virtual void OnLegendButtonExit(int index, string legendName)| +|OnPointerClick()||public override void OnPointerClick(PointerEventData eventData)| +|OnPointerDown()||public override void OnPointerDown(PointerEventData eventData)| +|OnPointerEnter()||public override void OnPointerEnter(PointerEventData eventData)| +|OnPointerExit()||public override void OnPointerExit(PointerEventData eventData)| +|OnPointerUp()||public override void OnPointerUp(PointerEventData eventData)| +|OnScroll()||public override void OnScroll(PointerEventData eventData)| +|RefreshBasePainter()||public void RefreshBasePainter()| +|RefreshChart()||public void RefreshChart()<br/>在下一帧刷新整个图表。 | +|RefreshChart()||public void RefreshChart(int serieIndex)<br/>在下一帧刷新图表的指定serie。 | +|RefreshChart()||public void RefreshChart(Serie serie)<br/>在下一帧刷新图表的指定serie。 | +|RefreshDataZoom()||public void RefreshDataZoom()<br/>在下一帧刷新DataZoom | +|RefreshGraph()||public override void RefreshGraph()| +|RefreshPainter()||public void RefreshPainter(int index)| +|RefreshPainter()||public void RefreshPainter(Serie serie)| +|RefreshTopPainter()||public void RefreshTopPainter()| +|RefreshUpperPainter()||public void RefreshUpperPainter()| +|RemoveAllChartComponent()||public void RemoveAllChartComponent()| +|RemoveAllSerie()|v3.2.0|public virtual void RemoveAllSerie()<br/>移除所有的Serie。当确认只需要移除Serie时使用该接口,其他情况下一般用RemoveData()。 | +|RemoveChartComponent()||public bool RemoveChartComponent(MainComponent component)| +|RemoveChartComponent()||public bool RemoveChartComponent(Type type, int index = 0)| +|RemoveChartComponent<T>()||public bool RemoveChartComponent<T>(int index = 0)| +|RemoveChartComponents()||public int RemoveChartComponents(Type type)| +|RemoveChartComponents<T>()||public int RemoveChartComponents<T>()| +|RemoveData()||public virtual void RemoveData()<br/>清空所有组件数据,并移除所有Serie。一般在图表重新初始化时使用。 注意:组件只清空数据部分,参数会保留不会被重置。 | +|RemoveData()||public virtual void RemoveData(string serieName)<br/>清除指定系列名称的数据。 | +|RemoveSerie()||public void RemoveSerie(int serieIndex)| +|RemoveSerie()||public void RemoveSerie(Serie serie)| +|RemoveSerie()||public void RemoveSerie(string serieName)| +|RemoveSerie<T>()||public void RemoveSerie<T>() where T : Serie| +|ReplaceSerie()||public bool ReplaceSerie(Serie oldSerie, Serie newSerie)| +|ResetDataIndex()||public bool ResetDataIndex(int serieIndex)<br/>重置serie的数据项索引。避免数据项索引异常。 | +|SetBasePainterMaterial()||public void SetBasePainterMaterial(Material material)<br/>设置Base Painter的材质球 | +|SetMaxCache()||public void SetMaxCache(int maxCache)<br/>设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。 | +|SetPainterActive()||public void SetPainterActive(int index, bool flag)| +|SetSerieActive()||public void SetSerieActive(int serieIndex, bool active)<br/>设置指定系列是否显示。 | +|SetSerieActive()||public void SetSerieActive(Serie serie, bool active)| +|SetSerieActive()||public void SetSerieActive(string serieName, bool active)<br/>设置指定系列是否显示。 | +|SetSeriePainterMaterial()||public void SetSeriePainterMaterial(Material material)<br/>设置Serie Painter的材质球 | +|SetTopPainterMaterial()||public void SetTopPainterMaterial(Material material)<br/>设置Top Painter的材质球 | +|SetUpperPainterMaterial()||public void SetUpperPainterMaterial(Material material)<br/>设置Upper Painter的材质球 | +|TryAddChartComponent()||public bool TryAddChartComponent(Type type)| +|TryAddChartComponent<T>()||public bool TryAddChartComponent<T>() where T : MainComponent| +|TryAddChartComponent<T>()||public bool TryAddChartComponent<T>(out T component) where T : MainComponent| +|TryGetChartComponent<T>()||public bool TryGetChartComponent<T>(out T component, int index = 0)| +|UpdateData()||public bool UpdateData(int serieIndex, int dataIndex, double value)<br/>更新指定系列中的指定索引数据。 | +|UpdateData()||public bool UpdateData(int serieIndex, int dataIndex, int dimension, double value)<br/>更新指定系列指定索引指定维数的数据。维数从0开始。 | +|UpdateData()||public bool UpdateData(int serieIndex, int dataIndex, List<double> multidimensionalData)<br/>更新指定系列指定索引的数据项的多维数据。 | +|UpdateData()||public bool UpdateData(string serieName, int dataIndex, double value)<br/>更新指定系列中的指定索引数据。 | +|UpdateData()||public bool UpdateData(string serieName, int dataIndex, int dimension, double value)<br/>更新指定系列指定索引指定维数的数据。维数从0开始。 | +|UpdateData()||public bool UpdateData(string serieName, int dataIndex, List<double> multidimensionalData)<br/>更新指定系列指定索引的数据项的多维数据。 | +|UpdateDataName()||public bool UpdateDataName(int serieIndex, int dataIndex, string dataName)<br/>更新指定系列中的指定索引数据名称。 | +|UpdateDataName()||public bool UpdateDataName(string serieName, int dataIndex, string dataName)<br/>更新指定系列中的指定索引数据名称。 | +|UpdateLegendColor()||public virtual void UpdateLegendColor(string legendName, bool active)| +|UpdateTheme()||public bool UpdateTheme(ThemeType theme)<br/>切换内置主题。 | +|UpdateTheme()||public void UpdateTheme(Theme theme)<br/>切换图表主题。 | +|UpdateXAxisData()||public void UpdateXAxisData(int index, string category, int xAxisIndex = 0)<br/>更新X轴类目数据。 | +|UpdateXAxisIcon()||public void UpdateXAxisIcon(int index, Sprite icon, int xAxisIndex = 0)<br/>更新X轴图标。 | +|UpdateYAxisData()||public void UpdateYAxisData(int index, string category, int yAxisIndex = 0)<br/>更新Y轴类目数据。 | +|UpdateYAxisIcon()||public void UpdateYAxisIcon(int index, Sprite icon, int yAxisIndex = 0)<br/>更新Y轴图标。 | ## BaseGraph Inherits or Implemented: [MaskableGraphic](#maskablegraphic),[IPointerDownHandler](#ipointerdownhandler),[IPointerUpHandler](#ipointeruphandler),[](#) -|public method|description| -|--|--| -| CheckWarning() |public string CheckWarning()<br/>检测警告信息。 | -| OnBeginDrag() |public virtual void OnBeginDrag(PointerEventData eventData)| -| OnDrag() |public virtual void OnDrag(PointerEventData eventData)| -| OnEndDrag() |public virtual void OnEndDrag(PointerEventData eventData)| -| OnPointerClick() |public virtual void OnPointerClick(PointerEventData eventData)| -| OnPointerDown() |public virtual void OnPointerDown(PointerEventData eventData)| -| OnPointerEnter() |public virtual void OnPointerEnter(PointerEventData eventData)| -| OnPointerExit() |public virtual void OnPointerExit(PointerEventData eventData)| -| OnPointerUp() |public virtual void OnPointerUp(PointerEventData eventData)| -| OnScroll() |public virtual void OnScroll(PointerEventData eventData)| -| RebuildChartObject() |public void RebuildChartObject()<br/>移除并重新创建所有图表的Object。 | -| RefreshAllComponent() |public void RefreshAllComponent()| -| RefreshGraph() |public virtual void RefreshGraph()<br/>在下一帧刷新图形。 | -| ScreenPointToChartPoint() |public bool ScreenPointToChartPoint(Vector2 screenPoint, out Vector2 chartPoint)| -| SetPainterDirty() |public void SetPainterDirty()<br/>重新初始化Painter | -| SetSize() |public virtual void SetSize(float width, float height)<br/>设置图形的宽高(在非stretch pivot下才有效,其他情况需要自己调整RectTransform) | +|public method|since|description| +|--|--|--| +|onBeginDrag||public Action<PointerEventData, BaseGraph> onBeginDrag<br/>鼠标开始拖拽回调。 | +|onDrag||public Action<PointerEventData, BaseGraph> onDrag<br/>鼠标拖拽回调。 | +|onEndDrag||public Action<PointerEventData, BaseGraph> onEndDrag<br/>鼠标结束拖拽回调。 | +|onPointerClick||public Action<PointerEventData, BaseGraph> onPointerClick<br/>鼠标点击回调。 | +|onPointerDown||public Action<PointerEventData, BaseGraph> onPointerDown<br/>鼠标按下回调。 | +|onPointerEnter||public Action<PointerEventData, BaseGraph> onPointerEnter<br/>鼠标进入回调。 | +|onPointerExit||public Action<PointerEventData, BaseGraph> onPointerExit<br/>鼠标退出回调。 | +|onPointerUp||public Action<PointerEventData, BaseGraph> onPointerUp<br/>鼠标弹起回调。 | +|onScroll||public Action<PointerEventData, BaseGraph> onScroll<br/>鼠标滚动回调。 | +|CheckWarning()||public string CheckWarning()<br/>检测警告信息。 | +|OnBeginDrag()||public virtual void OnBeginDrag(PointerEventData eventData)| +|OnDrag()||public virtual void OnDrag(PointerEventData eventData)| +|OnEndDrag()||public virtual void OnEndDrag(PointerEventData eventData)| +|OnPointerClick()||public virtual void OnPointerClick(PointerEventData eventData)| +|OnPointerDown()||public virtual void OnPointerDown(PointerEventData eventData)| +|OnPointerEnter()||public virtual void OnPointerEnter(PointerEventData eventData)| +|OnPointerExit()||public virtual void OnPointerExit(PointerEventData eventData)| +|OnPointerUp()||public virtual void OnPointerUp(PointerEventData eventData)| +|OnScroll()||public virtual void OnScroll(PointerEventData eventData)| +|RebuildChartObject()||public void RebuildChartObject()<br/>移除并重新创建所有图表的Object。 | +|RefreshAllComponent()||public void RefreshAllComponent()| +|RefreshGraph()||public virtual void RefreshGraph()<br/>在下一帧刷新图形。 | +|SaveAsImage()||public void SaveAsImage(string imageType = "png", string savePath = "")<br/>保存图表为图片。 | +|ScreenPointToChartPoint()||public bool ScreenPointToChartPoint(Vector2 screenPoint, out Vector2 chartPoint)| +|SetPainterDirty()||public void SetPainterDirty()<br/>重新初始化Painter | +|SetSize()||public virtual void SetSize(float width, float height)<br/>设置图形的宽高(在非stretch pivot下才有效,其他情况需要自己调整RectTransform) | ## CandlestickChart @@ -287,14 +378,14 @@ Inherits or Implemented: [BaseChart](#basechart) ## ChartCached -|public method|description| -|--|--| -| ColorToDotStr() |public static string ColorToDotStr(Color color)| -| ColorToStr() |public static string ColorToStr(Color color)| -| FloatToStr() |public static string FloatToStr(double value, string numericFormatter = "F", int precision = 0)| -| GetSerieLabelName() |public static string GetSerieLabelName(string prefix, int i, int j)| -| IntToStr() |public static string IntToStr(int value, string numericFormatter = "")| -| NumberToStr() |public static string NumberToStr(double value, string formatter)| +|public method|since|description| +|--|--|--| +|ColorToDotStr()||public static string ColorToDotStr(Color color)| +|ColorToStr()||public static string ColorToStr(Color color)| +|FloatToStr()||public static string FloatToStr(double value, string numericFormatter = "F", int precision = 0)| +|GetSerieLabelName()||public static string GetSerieLabelName(string prefix, int i, int j)| +|IntToStr()||public static string IntToStr(int value, string numericFormatter = "")| +|NumberToStr()||public static string NumberToStr(double value, string formatter)| ## ChartConst @@ -302,144 +393,147 @@ Inherits or Implemented: [BaseChart](#basechart) ## ChartHelper -|public method|description| -|--|--| -| ActiveAllObject() |public static void ActiveAllObject(Transform parent, bool active, string match = null)| -| AddIcon() |public static Image AddIcon(string name, Transform parent, IconStyle iconStyle)| -| Cancat() |public static string Cancat(string str1, int i)| -| Cancat() |public static string Cancat(string str1, string str2)| -| ClearEventListener() |public static void ClearEventListener(GameObject obj)| -| CopyArray<T>() |public static bool CopyArray<T>(T[] toList, T[] fromList)| -| CopyList<T>() |public static bool CopyList<T>(List<T> toList, List<T> fromList)| -| DestoryGameObject() |public static void DestoryGameObject(GameObject go)| -| DestoryGameObject() |public static void DestoryGameObject(Transform parent, string childName)| -| DestoryGameObjectByMatch() |public static void DestoryGameObjectByMatch(Transform parent, string match)| -| DestroyAllChildren() |public static void DestroyAllChildren(Transform parent)| -| GetActualValue() |public static float GetActualValue(float valueOrRate, float total, float maxRate = 1.5f)| -| GetAngle360() |public static float GetAngle360(Vector2 from, Vector2 to)<br/>获得0-360的角度(12点钟方向为0度) | -| GetBlurColor() |public static Color32 GetBlurColor(Color32 color, float a = 0.3f)| -| GetColor() |public static Color32 GetColor(string hexColorStr)| -| GetDire() |public static Vector3 GetDire(float angle, bool isDegree = false)| -| GetFloatAccuracy() |public static int GetFloatAccuracy(double value)| -| GetFullName() |public static string GetFullName(Transform transform)| -| GetHighlightColor() |public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)| -| GetLastValue() |public static Vector3 GetLastValue(List<Vector3> list)| -| GetMaxDivisibleValue() |public static double GetMaxDivisibleValue(double max, double ceilRate)| -| GetMaxLogValue() |public static double GetMaxLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)| -| GetMinDivisibleValue() |public static double GetMinDivisibleValue(double min, double ceilRate)| -| GetMinLogValue() |public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)| -| GetOrAddComponent<T>() |public static T GetOrAddComponent<T>(GameObject gameObject) where T : Component| -| GetOrAddComponent<T>() |public static T GetOrAddComponent<T>(Transform transform) where T : Component| -| GetPointList() |public static void GetPointList(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float k = 30f)| -| GetPos() |public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)| -| GetPosition() |public static Vector3 GetPosition(Vector3 center, float angle, float radius)| -| GetSelectColor() |public static Color32 GetSelectColor(Color32 color, float rate = 0.8f)| -| GetVertialDire() |public static Vector3 GetVertialDire(Vector3 dire)| -| HideAllObject() |public static void HideAllObject(GameObject obj, string match = null)| -| HideAllObject() |public static void HideAllObject(Transform parent, string match = null)| -| IsClearColor() |public static bool IsClearColor(Color color)| -| IsClearColor() |public static bool IsClearColor(Color32 color)| -| IsColorAlphaZero() |public static bool IsColorAlphaZero(Color color)| -| IsEquals() |public static bool IsEquals(double d1, double d2)| -| IsEquals() |public static bool IsEquals(float d1, float d2)| -| IsIngore() |public static bool IsIngore(Vector3 pos)| -| IsInRect() |public static bool IsInRect(Vector3 pos, float xMin, float xMax, float yMin, float yMax)| -| IsPointInQuadrilateral() |public static bool IsPointInQuadrilateral(Vector3 P, Vector3 A, Vector3 B, Vector3 C, Vector3 D)| -| IsValueEqualsColor() |public static bool IsValueEqualsColor(Color color1, Color color2)| -| IsValueEqualsColor() |public static bool IsValueEqualsColor(Color32 color1, Color32 color2)| -| IsValueEqualsList<T>() |public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)| -| IsValueEqualsString() |public static bool IsValueEqualsString(string str1, string str2)| -| IsValueEqualsVector2() |public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)| -| IsValueEqualsVector3() |public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)| -| IsZeroVector() |public static bool IsZeroVector(Vector3 pos)| -| ParseFloatFromString() |public static List<float> ParseFloatFromString(string jsonData)| -| ParseStringFromString() |public static List<string> ParseStringFromString(string jsonData)| -| RemoveComponent<T>() |public static void RemoveComponent<T>(GameObject gameObject)| -| RotateRound() |public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)| -| SaveAsImage() |public static Texture2D SaveAsImage(RectTransform rectTransform, Canvas canvas, string imageType = "png", string path = "")| -| SetActive() |public static void SetActive(GameObject gameObject, bool active)| -| SetActive() |public static void SetActive(Image image, bool active)| -| SetActive() |public static void SetActive(Text text, bool active)| -| SetActive() |public static void SetActive(Transform transform, bool active)<br/>通过设置scale实现是否显示,优化性能,减少GC | -| SetBackground() |public static void SetBackground(Image background, ImageStyle imageStyle)| -| SetColorOpacity() |public static void SetColorOpacity(ref Color32 color, float opacity)| +|public method|since|description| +|--|--|--| +|ActiveAllObject()||public static void ActiveAllObject(Transform parent, bool active, string match = null)| +|AddIcon()||public static Image AddIcon(string name, Transform parent, IconStyle iconStyle)| +|Cancat()||public static string Cancat(string str1, int i)| +|Cancat()||public static string Cancat(string str1, string str2)| +|ClearEventListener()||public static void ClearEventListener(GameObject obj)| +|CopyArray<T>()||public static bool CopyArray<T>(T[] toList, T[] fromList)| +|CopyList<T>()||public static bool CopyList<T>(List<T> toList, List<T> fromList)| +|DestoryGameObject()||public static void DestoryGameObject(GameObject go)| +|DestoryGameObject()||public static void DestoryGameObject(Transform parent, string childName)| +|DestoryGameObjectByMatch()||public static void DestoryGameObjectByMatch(Transform parent, string containString)| +|DestroyAllChildren()||public static void DestroyAllChildren(Transform parent)| +|EnsureComponent<T>()||public static T EnsureComponent<T>(GameObject gameObject) where T : Component<br/>确保对象有指定的组件,如果没有则添加。 | +|EnsureComponent<T>()||public static T EnsureComponent<T>(Transform transform) where T : Component<br/>确保对象有指定的组件,如果没有则添加。 | +|GetActualValue()||public static float GetActualValue(float valueOrRate, float total, float maxRate = 1.5f)| +|GetAngle360()||public static float GetAngle360(Vector2 from, Vector2 to)<br/>获得0-360的角度(12点钟方向为0度) | +|GetBlurColor()||public static Color32 GetBlurColor(Color32 color, float a = 0.3f)| +|GetColor()||public static Color32 GetColor(string hexColorStr)| +|GetDire()||public static Vector3 GetDire(float angle, bool isDegree = false)| +|GetFullName()||public static string GetFullName(Transform transform)| +|GetHighlightColor()||public static Color32 GetHighlightColor(Color32 color, float rate = 0.8f)| +|GetLastValue()||public static Vector3 GetLastValue(List<Vector3> list)| +|GetMaxDivisibleValue()||public static double GetMaxDivisibleValue(double max, double ceilRate)| +|GetMaxLogValue()||public static double GetMaxLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)| +|GetMinDivisibleValue()||public static double GetMinDivisibleValue(double min, double ceilRate)| +|GetMinLogValue()||public static double GetMinLogValue(double value, float logBase, bool isLogBaseE, out int splitNumber)| +|GetOrAddComponent<T>()||public static T GetOrAddComponent<T>(GameObject gameObject) where T : Component| +|GetOrAddComponent<T>()||public static T GetOrAddComponent<T>(Transform transform) where T : Component| +|GetPointList()||public static void GetPointList(ref List<Vector3> posList, Vector3 sp, Vector3 ep, float k = 30f)| +|GetPos()||public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)| +|GetPosition()||public static Vector3 GetPosition(Vector3 center, float angle, float radius)| +|GetSelectColor()||public static Color32 GetSelectColor(Color32 color, float rate = 0.8f)| +|GetVertialDire()||public static Vector3 GetVertialDire(Vector3 dire)| +|HideAllObject()||public static void HideAllObject(GameObject obj, string match = null)| +|HideAllObject()||public static void HideAllObject(Transform parent, string match = null)| +|IsClearColor()||public static bool IsClearColor(Color color)| +|IsClearColor()||public static bool IsClearColor(Color32 color)| +|IsColorAlphaZero()||public static bool IsColorAlphaZero(Color color)| +|IsEquals()||public static bool IsEquals(double d1, double d2)| +|IsEquals()||public static bool IsEquals(float d1, float d2)| +|IsIngore()||public static bool IsIngore(Vector3 pos)| +|IsInRect()||public static bool IsInRect(Vector3 pos, float xMin, float xMax, float yMin, float yMax)| +|IsPointInQuadrilateral()||public static bool IsPointInQuadrilateral(Vector3 P, Vector3 A, Vector3 B, Vector3 C, Vector3 D)| +|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color color1, Color color2)| +|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color32 color1, Color32 color2)| +|IsValueEqualsList<T>()||public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)| +|IsValueEqualsString()||public static bool IsValueEqualsString(string str1, string str2)| +|IsValueEqualsVector2()||public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)| +|IsValueEqualsVector3()||public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)| +|IsZeroVector()||public static bool IsZeroVector(Vector3 pos)| +|ParseFloatFromString()||public static List<float> ParseFloatFromString(string jsonData)| +|ParseStringFromString()||public static List<string> ParseStringFromString(string jsonData)| +|RemoveComponent<T>()||public static void RemoveComponent<T>(GameObject gameObject)| +|RotateRound()||public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)| +|SaveAsImage()||public static Texture2D SaveAsImage(RectTransform rectTransform, Canvas canvas, string imageType = "png", string path = "")| +|SetActive()||public static void SetActive(GameObject gameObject, bool active)| +|SetActive()||public static void SetActive(Image image, bool active)| +|SetActive()||public static void SetActive(Text text, bool active)| +|SetActive()||public static void SetActive(Transform transform, bool active)<br/>通过设置scale实现是否显示,优化性能,减少GC | +|SetBackground()||public static void SetBackground(Image background, ImageStyle imageStyle)| +|SetColorOpacity()||public static void SetColorOpacity(ref Color32 color, float opacity)| ## ChartLabel Inherits or Implemented: [Image](#image) -|public method|description| -|--|--| -| GetHeight() |public float GetHeight()| -| GetPosition() |public Vector3 GetPosition()| -| GetTextHeight() |public float GetTextHeight()| -| GetTextWidth() |public float GetTextWidth()| -| GetWidth() |public float GetWidth()| -| SetActive() |public void SetActive(bool flag)| -| SetIcon() |public void SetIcon(Image image)| -| SetIconActive() |public void SetIconActive(bool flag)| -| SetIconSize() |public void SetIconSize(float width, float height)| -| SetIconSprite() |public void SetIconSprite(Sprite sprite)| -| SetPadding() |public void SetPadding(float[] padding)| -| SetPosition() |public void SetPosition(Vector3 position)| -| SetRectPosition() |public void SetRectPosition(Vector3 position)| -| SetSize() |public void SetSize(float width, float height)| -| SetText() |public bool SetText(string text)| -| SetTextActive() |public void SetTextActive(bool flag)| -| SetTextColor() |public void SetTextColor(Color color)| -| SetTextPadding() |public void SetTextPadding(TextPadding padding)| -| SetTextRotate() |public void SetTextRotate(float rotate)| -| UpdateIcon() |public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null)| +|public method|since|description| +|--|--|--| +|GetHeight()||public float GetHeight()| +|GetPosition()||public Vector3 GetPosition()| +|GetTextHeight()||public float GetTextHeight()| +|GetTextWidth()||public float GetTextWidth()| +|GetWidth()||public float GetWidth()| +|IsActive()||public override bool IsActive()| +|SetActive()||public void SetActive(bool flag)| +|SetIcon()||public void SetIcon(Image image)| +|SetIconActive()||public void SetIconActive(bool flag)| +|SetIconSize()||public void SetIconSize(float width, float height)| +|SetIconSprite()||public void SetIconSprite(Sprite sprite)| +|SetPadding()||public void SetPadding(float[] padding)| +|SetPosition()||public void SetPosition(Vector3 position)| +|SetRectPosition()||public void SetRectPosition(Vector3 position)| +|SetRotate()||public void SetRotate(float rotate)| +|SetSize()||public void SetSize(float width, float height)| +|SetText()||public bool SetText(string text)| +|SetTextActive()||public void SetTextActive(bool flag)| +|SetTextColor()||public void SetTextColor(Color color)| +|SetTextPadding()||public void SetTextPadding(TextPadding padding)| +|SetTextRotate()||public void SetTextRotate(float rotate)| +|UpdateIcon()||public void UpdateIcon(IconStyle iconStyle, Sprite sprite = null)| ## ChartObject -|public method|description| -|--|--| -| Destroy() |public virtual void Destroy()| +|public method|since|description| +|--|--|--| +|Destroy()||public virtual void Destroy()| ## CheckHelper -|public method|description| -|--|--| -| CheckChart() |public static string CheckChart(BaseChart chart)| -| CheckChart() |public static string CheckChart(BaseGraph chart)| +|public method|since|description| +|--|--|--| +|CheckChart()||public static string CheckChart(BaseChart chart)| +|CheckChart()||public static string CheckChart(BaseGraph chart)| ## ColorUtil -|public method|description| -|--|--| -| GetColor() |public static Color32 GetColor(string hexColorStr)<br/>将字符串颜色值转成Color。 | +|public method|since|description| +|--|--|--| +|GetColor()||public static Color32 GetColor(string hexColorStr)<br/>将字符串颜色值转成Color。 | ## ComponentHandlerAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| ComponentHandlerAttribute() |public ComponentHandlerAttribute(Type handler)| -| ComponentHandlerAttribute() |public ComponentHandlerAttribute(Type handler, bool allowMultiple)| +|public method|since|description| +|--|--|--| +|ComponentHandlerAttribute()||public ComponentHandlerAttribute(Type handler)| +|ComponentHandlerAttribute()||public ComponentHandlerAttribute(Type handler, bool allowMultiple)| ## ComponentHelper -|public method|description| -|--|--| -| GetAngleAxis() |public static AngleAxis GetAngleAxis(List<MainComponent> components, int polarIndex)| -| GetRadiusAxis() |public static RadiusAxis GetRadiusAxis(List<MainComponent> components, int polarIndex)| -| GetXAxisOnZeroOffset() |public static float GetXAxisOnZeroOffset(List<MainComponent> components, XAxis axis)| -| GetYAxisOnZeroOffset() |public static float GetYAxisOnZeroOffset(List<MainComponent> components, YAxis axis)| -| IsAnyCategoryOfYAxis() |public static bool IsAnyCategoryOfYAxis(List<MainComponent> components)| +|public method|since|description| +|--|--|--| +|GetAngleAxis()||public static AngleAxis GetAngleAxis(List<MainComponent> components, int polarIndex)| +|GetRadiusAxis()||public static RadiusAxis GetRadiusAxis(List<MainComponent> components, int polarIndex)| +|GetXAxisOnZeroOffset()||public static float GetXAxisOnZeroOffset(List<MainComponent> components, XAxis axis)| +|GetYAxisOnZeroOffset()||public static float GetYAxisOnZeroOffset(List<MainComponent> components, YAxis axis)| +|IsAnyCategoryOfYAxis()||public static bool IsAnyCategoryOfYAxis(List<MainComponent> components)| ## CoordOptionsAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Contains<T>() |public bool Contains<T>() where T : CoordSystem| -| CoordOptionsAttribute() |public CoordOptionsAttribute(Type coord)| -| CoordOptionsAttribute() |public CoordOptionsAttribute(Type coord, Type coord2)| -| CoordOptionsAttribute() |public CoordOptionsAttribute(Type coord, Type coord2, Type coord3)| -| CoordOptionsAttribute() |public CoordOptionsAttribute(Type coord, Type coord2, Type coord3, Type coord4)| +|public method|since|description| +|--|--|--| +|Contains<T>()||public bool Contains<T>() where T : CoordSystem| +|CoordOptionsAttribute()||public CoordOptionsAttribute(Type coord)| +|CoordOptionsAttribute()||public CoordOptionsAttribute(Type coord, Type coord2)| +|CoordOptionsAttribute()||public CoordOptionsAttribute(Type coord, Type coord2, Type coord3)| +|CoordOptionsAttribute()||public CoordOptionsAttribute(Type coord, Type coord2, Type coord3, Type coord4)| ## DataZoomContext @@ -447,43 +541,43 @@ Inherits or Implemented: [MainComponentContext](#maincomponentcontext) ## DataZoomHelper -|public method|description| -|--|--| -| UpdateDataZoomRuntimeStartEndValue() |public static void UpdateDataZoomRuntimeStartEndValue(DataZoom dataZoom, Serie serie)| -| UpdateDataZoomRuntimeStartEndValue<T>() |public static void UpdateDataZoomRuntimeStartEndValue<T>(BaseChart chart) where T : Serie| +|public method|since|description| +|--|--|--| +|UpdateDataZoomRuntimeStartEndValue()||public static void UpdateDataZoomRuntimeStartEndValue(DataZoom dataZoom, Serie serie)| +|UpdateDataZoomRuntimeStartEndValue<T>()||public static void UpdateDataZoomRuntimeStartEndValue<T>(BaseChart chart) where T : Serie| ## DateTimeUtil -|public method|description| -|--|--| -| GetDateTime() |public static DateTime GetDateTime(int timestamp)| -| GetTimestamp() |public static int GetTimestamp()| -| GetTimestamp() |public static int GetTimestamp(DateTime time)| +|public method|since|description| +|--|--|--| +|GetDateTime()||public static DateTime GetDateTime(int timestamp)| +|GetTimestamp()||public static int GetTimestamp()| +|GetTimestamp()||public static int GetTimestamp(DateTime time)| ## DefaultAnimationAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| DefaultAnimationAttribute() |public DefaultAnimationAttribute(AnimationType handler)| +|public method|since|description| +|--|--|--| +|DefaultAnimationAttribute()||public DefaultAnimationAttribute(AnimationType handler)| ## DefineSymbolsUtil -|public method|description| -|--|--| -| AddGlobalDefine() |public static void AddGlobalDefine(string symbol)| -| RemoveGlobalDefine() |public static void RemoveGlobalDefine(string symbol)| +|public method|since|description| +|--|--|--| +|AddGlobalDefine()||public static void AddGlobalDefine(string symbol)| +|RemoveGlobalDefine()||public static void RemoveGlobalDefine(string symbol)| ## FormatterHelper -|public method|description| -|--|--| -| NeedFormat() |public static bool NeedFormat(string content)| -| ReplaceAxisLabelContent() |public static void ReplaceAxisLabelContent(ref string content, string numericFormatter, double value)| -| ReplaceAxisLabelContent() |public static void ReplaceAxisLabelContent(ref string content, string value)| -| TrimAndReplaceLine() |public static string TrimAndReplaceLine(string content)| -| TrimAndReplaceLine() |public static string TrimAndReplaceLine(StringBuilder sb)| +|public method|since|description| +|--|--|--| +|NeedFormat()||public static bool NeedFormat(string content)| +|ReplaceAxisLabelContent()||public static void ReplaceAxisLabelContent(ref string content, string numericFormatter, double value)| +|ReplaceAxisLabelContent()||public static void ReplaceAxisLabelContent(ref string content, string value)| +|TrimAndReplaceLine()||public static string TrimAndReplaceLine(string content)| +|TrimAndReplaceLine()||public static string TrimAndReplaceLine(StringBuilder sb)| ## GridCoordContext @@ -497,32 +591,39 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| IgnoreDoc() |public IgnoreDoc()| +|public method|since|description| +|--|--|--| +|IgnoreDoc()||public IgnoreDoc()| + +## InputHelper + +|public method|since|description| +|--|--|--| +|GetKeyDown()||public static bool GetKeyDown(KeyCode keyCode)| +|GetTouch()||public static Touch GetTouch(int v)| ## InteractData -|public method|description| -|--|--| -| Reset() |public void Reset()| -| SetColor() |public void SetColor(ref bool needInteract, Color32 color)| -| SetColor() |public void SetColor(ref bool needInteract, Color32 color, Color32 toColor)| -| SetValue() |public void SetValue(ref bool needInteract, float size)| -| SetValue() |public void SetValue(ref bool needInteract, float size, bool highlight, float rate = 1.3f)| -| SetValueAndColor() |public void SetValueAndColor(ref bool needInteract, float value, Color32 color)| -| SetValueAndColor() |public void SetValueAndColor(ref bool needInteract, float value, Color32 color, Color32 toColor)| -| TryGetColor() |public bool TryGetColor(ref Color32 color, ref bool interacting, float animationDuration = 250)| -| TryGetColor() |public bool TryGetColor(ref Color32 color, ref Color32 toColor, ref bool interacting, float animationDuration = 250)| -| TryGetValue() |public bool TryGetValue(ref float value, ref bool interacting, float animationDuration = 250)| -| TryGetValueAndColor() |public bool TryGetValueAndColor(ref float value, ref Color32 color, ref Color32 toColor, ref bool interacting, float animationDuration = 250)| +|public method|since|description| +|--|--|--| +|Reset()||public void Reset()| +|SetColor()||public void SetColor(ref bool needInteract, Color32 color)| +|SetColor()||public void SetColor(ref bool needInteract, Color32 color, Color32 toColor)| +|SetValue()||public void SetValue(ref bool needInteract, float size)| +|SetValue()||public void SetValue(ref bool needInteract, float size, bool highlight, float rate = 1.3f)| +|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color)| +|SetValueAndColor()||public void SetValueAndColor(ref bool needInteract, float value, Color32 color, Color32 toColor)| +|TryGetColor()||public bool TryGetColor(ref Color32 color, ref bool interacting, float animationDuration = 250)| +|TryGetColor()||public bool TryGetColor(ref Color32 color, ref Color32 toColor, ref bool interacting, float animationDuration = 250)| +|TryGetValue()||public bool TryGetValue(ref float value, ref bool interacting, float animationDuration = 250)| +|TryGetValueAndColor()||public bool TryGetValueAndColor(ref float value, ref Color32 color, ref Color32 toColor, ref bool interacting, float animationDuration = 250)| ## LayerHelper -|public method|description| -|--|--| -| IsFixedWidthHeight() |public static bool IsFixedWidthHeight(RectTransform rt)| -| IsStretchPivot() |public static bool IsStretchPivot(RectTransform rt)| +|public method|since|description| +|--|--|--| +|IsFixedWidthHeight()||public static bool IsFixedWidthHeight(RectTransform rt)| +|IsStretchPivot()||public static bool IsStretchPivot(RectTransform rt)| ## LegendContext @@ -530,37 +631,37 @@ Inherits or Implemented: [MainComponentContext](#maincomponentcontext) ## LegendHelper -|public method|description| -|--|--| -| CheckDataHighlighted() |public static bool CheckDataHighlighted(Serie serie, string legendName, bool heighlight)| -| CheckDataShow() |public static bool CheckDataShow(Serie serie, string legendName, bool show)| -| GetContentColor() |public static Color GetContentColor(BaseChart chart, int legendIndex, string legendName, Legend legend, ThemeStyle theme, bool active)| -| GetIconColor() |public static Color GetIconColor(BaseChart chart, Legend legend, int readIndex, string legendName, bool active)| -| ResetItemPosition() |public static void ResetItemPosition(Legend legend, Vector3 chartPos, float chartWidth, float chartHeight)| -| SetLegendBackground() |public static void SetLegendBackground(Legend legend, ImageStyle style)| +|public method|since|description| +|--|--|--| +|CheckDataHighlighted()||public static bool CheckDataHighlighted(Serie serie, string legendName, bool heighlight)| +|CheckDataShow()||public static bool CheckDataShow(Serie serie, string legendName, bool show)| +|GetContentColor()||public static Color GetContentColor(BaseChart chart, int legendIndex, string legendName, Legend legend, ThemeStyle theme, bool active)| +|GetIconColor()||public static Color GetIconColor(BaseChart chart, Legend legend, int readIndex, string legendName, bool active)| +|ResetItemPosition()||public static void ResetItemPosition(Legend legend, Vector3 chartPos, float chartWidth, float chartHeight)| +|SetLegendBackground()||public static void SetLegendBackground(Legend legend, ImageStyle style)| ## LegendItem -|public method|description| -|--|--| -| GetIconColor() |public Color GetIconColor()| -| GetIconRect() |public Rect GetIconRect()| -| SetActive() |public void SetActive(bool active)| -| SetBackground() |public void SetBackground(ImageStyle imageStyle)| -| SetButton() |public void SetButton(Button button)| -| SetContent() |public bool SetContent(string content)| -| SetContentBackgroundColor() |public void SetContentBackgroundColor(Color color)| -| SetContentColor() |public void SetContentColor(Color color)| -| SetContentPosition() |public void SetContentPosition(Vector3 offset)| -| SetIcon() |public void SetIcon(Image icon)| -| SetIconActive() |public void SetIconActive(bool active)| -| SetIconColor() |public void SetIconColor(Color color)| -| SetIconImage() |public void SetIconImage(Sprite image)| -| SetIconSize() |public void SetIconSize(float width, float height)| -| SetObject() |public void SetObject(GameObject obj)| -| SetPosition() |public void SetPosition(Vector3 position)| -| SetText() |public void SetText(ChartText text)| -| SetTextBackground() |public void SetTextBackground(Image image)| +|public method|since|description| +|--|--|--| +|GetIconColor()||public Color GetIconColor()| +|GetIconRect()||public Rect GetIconRect()| +|SetActive()||public void SetActive(bool active)| +|SetBackground()||public void SetBackground(ImageStyle imageStyle)| +|SetButton()||public void SetButton(Button button)| +|SetContent()||public bool SetContent(string content)| +|SetContentBackgroundColor()||public void SetContentBackgroundColor(Color color)| +|SetContentColor()||public void SetContentColor(Color color)| +|SetContentPosition()||public void SetContentPosition(Vector3 offset)| +|SetIcon()||public void SetIcon(Image icon)| +|SetIconActive()||public void SetIconActive(bool active)| +|SetIconColor()||public void SetIconColor(Color color)| +|SetIconImage()||public void SetIconImage(Sprite image)| +|SetIconSize()||public void SetIconSize(float width, float height)| +|SetObject()||public void SetObject(GameObject obj)| +|SetPosition()||public void SetPosition(Vector3 position)| +|SetText()||public void SetText(ChartText text)| +|SetTextBackground()||public void SetTextBackground(Image image)| ## LineChart @@ -570,49 +671,49 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| ListFor() |public ListFor(Type type)| +|public method|since|description| +|--|--|--| +|ListFor()||public ListFor(Type type)| ## ListForComponent Inherits or Implemented: [ListFor](#listfor) -|public method|description| -|--|--| -| ListForComponent() |public ListForComponent(Type type) : base(type)| +|public method|since|description| +|--|--|--| +|ListForComponent()||public ListForComponent(Type type) : base(type)| ## ListForSerie Inherits or Implemented: [ListFor](#listfor) -|public method|description| -|--|--| -| ListForSerie() |public ListForSerie(Type type) : base(type)| +|public method|since|description| +|--|--|--| +|ListForSerie()||public ListForSerie(Type type) : base(type)| ## MainComponentContext ## MainComponentHandler -|public method|description| -|--|--| -| CheckComponent() |public virtual void CheckComponent(StringBuilder sb) { }| -| DrawBase() |public virtual void DrawBase(VertexHelper vh) { }| -| DrawTop() |public virtual void DrawTop(VertexHelper vh) { }| -| DrawUpper() |public virtual void DrawUpper(VertexHelper vh) { }| -| InitComponent() |public virtual void InitComponent() { }| -| OnBeginDrag() |public virtual void OnBeginDrag(PointerEventData eventData) { }| -| OnDrag() |public virtual void OnDrag(PointerEventData eventData) { }| -| OnEndDrag() |public virtual void OnEndDrag(PointerEventData eventData) { }| -| OnPointerClick() |public virtual void OnPointerClick(PointerEventData eventData) { }| -| OnPointerDown() |public virtual void OnPointerDown(PointerEventData eventData) { }| -| OnPointerEnter() |public virtual void OnPointerEnter(PointerEventData eventData) { }| -| OnPointerExit() |public virtual void OnPointerExit(PointerEventData eventData) { }| -| OnPointerUp() |public virtual void OnPointerUp(PointerEventData eventData) { }| -| OnScroll() |public virtual void OnScroll(PointerEventData eventData) { }| -| OnSerieDataUpdate() |public virtual void OnSerieDataUpdate(int serieIndex) { }| -| RemoveComponent() |public virtual void RemoveComponent() { }| -| Update() |public virtual void Update() { }| +|public method|since|description| +|--|--|--| +|CheckComponent()||public virtual void CheckComponent(StringBuilder sb) { }| +|DrawBase()||public virtual void DrawBase(VertexHelper vh) { }| +|DrawTop()||public virtual void DrawTop(VertexHelper vh) { }| +|DrawUpper()||public virtual void DrawUpper(VertexHelper vh) { }| +|InitComponent()||public virtual void InitComponent() { }| +|OnBeginDrag()||public virtual void OnBeginDrag(PointerEventData eventData) { }| +|OnDrag()||public virtual void OnDrag(PointerEventData eventData) { }| +|OnEndDrag()||public virtual void OnEndDrag(PointerEventData eventData) { }| +|OnPointerClick()||public virtual void OnPointerClick(PointerEventData eventData) { }| +|OnPointerDown()||public virtual void OnPointerDown(PointerEventData eventData) { }| +|OnPointerEnter()||public virtual void OnPointerEnter(PointerEventData eventData) { }| +|OnPointerExit()||public virtual void OnPointerExit(PointerEventData eventData) { }| +|OnPointerUp()||public virtual void OnPointerUp(PointerEventData eventData) { }| +|OnScroll()||public virtual void OnScroll(PointerEventData eventData) { }| +|OnSerieDataUpdate()||public virtual void OnSerieDataUpdate(int serieIndex) { }| +|RemoveComponent()||public virtual void RemoveComponent() { }| +|Update()||public virtual void Update() { }| ## MainComponentHandler<T> @@ -620,35 +721,39 @@ Inherits or Implemented: [MainComponentHandler](#maincomponenthandler) ## MathUtil -|public method|description| -|--|--| -| Abs() |public static double Abs(double d)| -| Approximately() |public static bool Approximately(double a, double b)| -| Clamp() |public static double Clamp(double d, double min, double max)| -| Clamp01() |public static double Clamp01(double value)| -| Lerp() |public static double Lerp(double a, double b, double t)| +|public method|since|description| +|--|--|--| +|Abs()||public static double Abs(double d)| +|Approximately()||public static bool Approximately(double a, double b)| +|Clamp()||public static double Clamp(double d, double min, double max)| +|Clamp01()||public static double Clamp01(double value)| +|GetPrecision()||public static int GetPrecision(double value)| +|IsInteger()||public static bool IsInteger(double value)| +|Lerp()||public static double Lerp(double a, double b, double t)| ## ObjectPool<T> where T Inherits or Implemented: [new()](#new()) -|public method|description| -|--|--| -| ClearAll() |public void ClearAll()| -| Get() |public T Get()| -| new() |public class ObjectPool<T> where T : new()| -| ObjectPool() |public ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease, bool newIfEmpty = true)| -| Release() |public void Release(T element)| +|public method|since|description| +|--|--|--| +|ClearAll()||public void ClearAll()| +|Get()||public T Get()| +|new()||public class ObjectPool<T> where T : new()| +|ObjectPool()||public ObjectPool(UnityAction<T> actionOnGet, UnityAction<T> actionOnRelease, bool newIfEmpty = true)| +|Release()||public void Release(T element)| ## Painter Inherits or Implemented: [MaskableGraphic](#maskablegraphic) -|public method|description| -|--|--| -| Init() |public void Init()| -| Refresh() |public void Refresh()| -| SetActive() |public void SetActive(bool flag, bool isDebugMode = false)| +|public method|since|description| +|--|--|--| +|onPopulateMesh||public Action<VertexHelper, Painter> onPopulateMesh| +|CheckRefresh()||public void CheckRefresh()| +|Init()||public void Init()| +|Refresh()||public void Refresh()| +|SetActive()||public void SetActive(bool flag, bool isDebugMode = false)| ## ParallelChart @@ -670,18 +775,14 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [MainComponentContext](#maincomponentcontext) -## ProgressBar - -Inherits or Implemented: [BaseChart](#basechart) - ## PropertyUtil -|public method|description| -|--|--| -| SetClass<T>() |public static bool SetClass<T>(ref T currentValue, T newValue, bool notNull = false) where T : class| -| SetColor() |public static bool SetColor(ref Color currentValue, Color newValue)| -| SetColor() |public static bool SetColor(ref Color32 currentValue, Color32 newValue)| -| SetStruct<T>() |public static bool SetStruct<T>(ref T currentValue, T newValue) where T : struct| +|public method|since|description| +|--|--|--| +|SetClass<T>()||public static bool SetClass<T>(ref T currentValue, T newValue, bool notNull = false) where T : class| +|SetColor()||public static bool SetColor(ref Color currentValue, Color newValue)| +|SetColor()||public static bool SetColor(ref Color32 currentValue, Color32 newValue)| +|SetStruct<T>()||public static bool SetStruct<T>(ref T currentValue, T newValue) where T : struct| ## RadarChart @@ -693,24 +794,24 @@ Inherits or Implemented: [MainComponentContext](#maincomponentcontext) ## ReflectionUtil -|public method|description| -|--|--| -| DeepCloneSerializeField() |public static object DeepCloneSerializeField(object obj)| -| InvokeListAdd() |public static void InvokeListAdd(object obj, FieldInfo field, object item)| -| InvokeListAddTo<T>() |public static void InvokeListAddTo<T>(object obj, FieldInfo field, Action<T> callback)| -| InvokeListClear() |public static void InvokeListClear(object obj, FieldInfo field)| -| InvokeListCount() |public static int InvokeListCount(object obj, FieldInfo field)| -| InvokeListGet<T>() |public static T InvokeListGet<T>(object obj, FieldInfo field, int i)| +|public method|since|description| +|--|--|--| +|DeepCloneSerializeField()||public static object DeepCloneSerializeField(object obj)| +|InvokeListAdd()||public static void InvokeListAdd(object obj, FieldInfo field, object item)| +|InvokeListAddTo<T>()||public static void InvokeListAddTo<T>(object obj, FieldInfo field, Action<T> callback)| +|InvokeListClear()||public static void InvokeListClear(object obj, FieldInfo field)| +|InvokeListCount()||public static int InvokeListCount(object obj, FieldInfo field)| +|InvokeListGet<T>()||public static T InvokeListGet<T>(object obj, FieldInfo field, int i)| ## RequireChartComponentAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| RequireChartComponentAttribute() |public RequireChartComponentAttribute(Type requiredComponent)| -| RequireChartComponentAttribute() |public RequireChartComponentAttribute(Type requiredComponent, Type requiredComponent2)| -| RequireChartComponentAttribute() |public RequireChartComponentAttribute(Type requiredComponent, Type requiredComponent2, Type requiredComponent3)| +|public method|since|description| +|--|--|--| +|RequireChartComponentAttribute()||public RequireChartComponentAttribute(Type requiredComponent)| +|RequireChartComponentAttribute()||public RequireChartComponentAttribute(Type requiredComponent, Type requiredComponent2)| +|RequireChartComponentAttribute()||public RequireChartComponentAttribute(Type requiredComponent, Type requiredComponent2, Type requiredComponent3)| ## RingChart @@ -718,227 +819,245 @@ Inherits or Implemented: [BaseChart](#basechart) ## RuntimeUtil -|public method|description| -|--|--| -| GetAllAssemblyTypes() |public static IEnumerable<Type> GetAllAssemblyTypes()| -| GetAllTypesDerivedFrom() |public static IEnumerable<Type> GetAllTypesDerivedFrom(Type type)| -| GetAllTypesDerivedFrom<T>() |public static IEnumerable<Type> GetAllTypesDerivedFrom<T>()| -| GetAttribute<T>() |public static T GetAttribute<T>(this MemberInfo type, bool check = true) where T : Attribute| -| GetAttribute<T>() |public static T GetAttribute<T>(this Type type, bool check = true) where T : Attribute| -| HasSubclass() |public static bool HasSubclass(Type type)| +|public method|since|description| +|--|--|--| +|GetAllAssemblyTypes()||public static IEnumerable<Type> GetAllAssemblyTypes()| +|GetAllTypesDerivedFrom()||public static IEnumerable<Type> GetAllTypesDerivedFrom(Type type)| +|GetAllTypesDerivedFrom<T>()||public static IEnumerable<Type> GetAllTypesDerivedFrom<T>()| +|GetAttribute<T>()||public static T GetAttribute<T>(this MemberInfo type, bool check = true) where T : Attribute| +|GetAttribute<T>()||public static T GetAttribute<T>(this Type type, bool check = true) where T : Attribute| +|HasSubclass()||public static bool HasSubclass(Type type)| ## ScatterChart Inherits or Implemented: [BaseChart](#basechart) +## SerieComponentAttribute + +Inherits or Implemented: [Attribute](#attribute) + +|public method|since|description| +|--|--|--| +|Contains()||public bool Contains(Type type)| +|Contains<T>()||public bool Contains<T>() where T : ISerieComponent| +|SerieComponentAttribute()||public SerieComponentAttribute()| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)| +|SerieComponentAttribute()||public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)| + ## SerieContext ## SerieConvertAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Contains() |public bool Contains(Type type)| -| Contains<T>() |public bool Contains<T>() where T : Serie| -| SerieConvertAttribute() |public SerieConvertAttribute(Type serie)| -| SerieConvertAttribute() |public SerieConvertAttribute(Type serie, Type serie2)| -| SerieConvertAttribute() |public SerieConvertAttribute(Type serie, Type serie2, Type serie3)| -| SerieConvertAttribute() |public SerieConvertAttribute(Type serie, Type serie2, Type serie3, Type serie4)| +|public method|since|description| +|--|--|--| +|Contains()||public bool Contains(Type type)| +|Contains<T>()||public bool Contains<T>() where T : Serie| +|SerieConvertAttribute()||public SerieConvertAttribute(Type serie)| +|SerieConvertAttribute()||public SerieConvertAttribute(Type serie, Type serie2)| +|SerieConvertAttribute()||public SerieConvertAttribute(Type serie, Type serie2, Type serie3)| +|SerieConvertAttribute()||public SerieConvertAttribute(Type serie, Type serie2, Type serie3, Type serie4)| -## SerieDataContext - -|public method|description| -|--|--| -| Reset() |public void Reset()| - -## SerieDataExtraComponentAttribute +## SerieDataComponentAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Contains() |public bool Contains(Type type)| -| Contains<T>() |public bool Contains<T>() where T : ISerieExtraComponent| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute()| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)| -| SerieDataExtraComponentAttribute() |public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)| +|public method|since|description| +|--|--|--| +|Contains()||public bool Contains(Type type)| +|Contains<T>()||public bool Contains<T>() where T : ISerieComponent| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute()| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)| +|SerieDataComponentAttribute()||public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)| + +## SerieDataContext + +|public method|since|description| +|--|--|--| +|Reset()||public void Reset()| ## SerieDataExtraFieldAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Contains() |public bool Contains(string field)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute()| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6)| -| SerieDataExtraFieldAttribute() |public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6, string field7)| +|public method|since|description| +|--|--|--| +|Contains()||public bool Contains(string field)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute()| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6)| +|SerieDataExtraFieldAttribute()||public SerieDataExtraFieldAttribute(string field1, string field2, string field3, string field4, string field5, string field6, string field7)| -## SerieExtraComponentAttribute +## SerieEventData -Inherits or Implemented: [Attribute](#attribute) +|public method|since|description| +|--|--|--| +|Reset()||public void Reset()| -|public method|description| -|--|--| -| Contains() |public bool Contains(Type type)| -| Contains<T>() |public bool Contains<T>() where T : ISerieExtraComponent| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute()| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6)| -| SerieExtraComponentAttribute() |public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7)| +## SerieEventDataPool + +|public method|since|description| +|--|--|--| +|Get()||public static SerieEventData Get(Vector3 pos, int serieIndex, int dataIndex, int dimension, double value)| +|Release()||public static void Release(SerieEventData toRelease)| ## SerieHandler -|public method|description| -|--|--| -| CheckComponent() |public virtual void CheckComponent(StringBuilder sb) { }| -| DrawBase() |public virtual void DrawBase(VertexHelper vh) { }| -| DrawSerie() |public virtual void DrawSerie(VertexHelper vh) { }| -| DrawTop() |public virtual void DrawTop(VertexHelper vh) { }| -| DrawUpper() |public virtual void DrawUpper(VertexHelper vh) { }| -| InitComponent() |public virtual void InitComponent() { }| -| OnBeginDrag() |public virtual void OnBeginDrag(PointerEventData eventData) { }| -| OnDrag() |public virtual void OnDrag(PointerEventData eventData) { }| -| OnEndDrag() |public virtual void OnEndDrag(PointerEventData eventData) { }| -| OnLegendButtonClick() |public virtual void OnLegendButtonClick(int index, string legendName, bool show) { }| -| OnLegendButtonEnter() |public virtual void OnLegendButtonEnter(int index, string legendName) { }| -| OnLegendButtonExit() |public virtual void OnLegendButtonExit(int index, string legendName) { }| -| OnPointerClick() |public virtual void OnPointerClick(PointerEventData eventData) { }| -| OnPointerDown() |public virtual void OnPointerDown(PointerEventData eventData) { }| -| OnPointerEnter() |public virtual void OnPointerEnter(PointerEventData eventData) { }| -| OnPointerExit() |public virtual void OnPointerExit(PointerEventData eventData) { }| -| OnPointerUp() |public virtual void OnPointerUp(PointerEventData eventData) { }| -| OnScroll() |public virtual void OnScroll(PointerEventData eventData) { }| -| RefreshLabelInternal() |public virtual void RefreshLabelInternal() { }| -| RefreshLabelNextFrame() |public virtual void RefreshLabelNextFrame() { }| -| RemoveComponent() |public virtual void RemoveComponent() { }| -| Update() |public virtual void Update() { }| +|public method|since|description| +|--|--|--| +|CheckComponent()||public virtual void CheckComponent(StringBuilder sb) { }| +|DrawBase()||public virtual void DrawBase(VertexHelper vh) { }| +|DrawSerie()||public virtual void DrawSerie(VertexHelper vh) { }| +|DrawTop()||public virtual void DrawTop(VertexHelper vh) { }| +|DrawUpper()||public virtual void DrawUpper(VertexHelper vh) { }| +|InitComponent()||public virtual void InitComponent() { }| +|OnBeginDrag()||public virtual void OnBeginDrag(PointerEventData eventData) { }| +|OnDrag()||public virtual void OnDrag(PointerEventData eventData) { }| +|OnEndDrag()||public virtual void OnEndDrag(PointerEventData eventData) { }| +|OnLegendButtonClick()||public virtual void OnLegendButtonClick(int index, string legendName, bool show) { }| +|OnLegendButtonEnter()||public virtual void OnLegendButtonEnter(int index, string legendName) { }| +|OnLegendButtonExit()||public virtual void OnLegendButtonExit(int index, string legendName) { }| +|OnPointerClick()||public virtual void OnPointerClick(PointerEventData eventData) { }| +|OnPointerDown()||public virtual void OnPointerDown(PointerEventData eventData) { }| +|OnPointerEnter()||public virtual void OnPointerEnter(PointerEventData eventData) { }| +|OnPointerExit()||public virtual void OnPointerExit(PointerEventData eventData) { }| +|OnPointerUp()||public virtual void OnPointerUp(PointerEventData eventData) { }| +|OnScroll()||public virtual void OnScroll(PointerEventData eventData) { }| +|RefreshLabelInternal()||public virtual void RefreshLabelInternal() { }| +|RefreshLabelNextFrame()||public virtual void RefreshLabelNextFrame() { }| +|RemoveComponent()||public virtual void RemoveComponent() { }| +|Update()||public virtual void Update() { }| +|UpdateSerieContext()||public virtual void UpdateSerieContext() { }| ## SerieHandler<T> Inherits or Implemented: [SerieHandler where T](#seriehandler where t),[Serie](#serie) -|public method|description| -|--|--| -| DrawLabelLineSymbol() |public void DrawLabelLineSymbol(VertexHelper vh, LabelLine labelLine, Vector3 startPos, Vector3 endPos, Color32 defaultColor)| -| GetSerieDataAutoColor() |public virtual Color GetSerieDataAutoColor(SerieData serieData)| -| GetSerieDataLabelOffset() |public virtual Vector3 GetSerieDataLabelOffset(SerieData serieData, LabelStyle label)| -| GetSerieDataLabelPosition() |public virtual Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label)| -| GetSerieDataTitlePosition() |public virtual Vector3 GetSerieDataTitlePosition(SerieData serieData, TitleStyle titleStyle)| -| InitComponent() |public override void InitComponent()| -| OnLegendButtonClick() |public override void OnLegendButtonClick(int index, string legendName, bool show)| -| OnLegendButtonEnter() |public override void OnLegendButtonEnter(int index, string legendName)| -| OnLegendButtonExit() |public override void OnLegendButtonExit(int index, string legendName)| -| RefreshEndLabelInternal() |public virtual void RefreshEndLabelInternal()| -| RefreshLabelInternal() |public override void RefreshLabelInternal()| -| RefreshLabelNextFrame() |public override void RefreshLabelNextFrame()| -| RemoveComponent() |public override void RemoveComponent()| -| Update() |public override void Update()| +|public method|since|description| +|--|--|--| +|DrawLabelLineSymbol()||public void DrawLabelLineSymbol(VertexHelper vh, LabelLine labelLine, Vector3 startPos, Vector3 endPos, Color32 defaultColor)| +|GetPointerItemDataDimension()||public override int GetPointerItemDataDimension()| +|GetPointerItemDataIndex()||public override int GetPointerItemDataIndex()| +|GetSerieDataAutoColor()||public virtual Color GetSerieDataAutoColor(SerieData serieData)| +|GetSerieDataLabelOffset()||public virtual Vector3 GetSerieDataLabelOffset(SerieData serieData, LabelStyle label)| +|GetSerieDataLabelPosition()||public virtual Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label)| +|GetSerieDataTitlePosition()||public virtual Vector3 GetSerieDataTitlePosition(SerieData serieData, TitleStyle titleStyle)| +|InitComponent()||public override void InitComponent()| +|OnLegendButtonClick()||public override void OnLegendButtonClick(int index, string legendName, bool show)| +|OnLegendButtonEnter()||public override void OnLegendButtonEnter(int index, string legendName)| +|OnLegendButtonExit()||public override void OnLegendButtonExit(int index, string legendName)| +|OnPointerClick()||public override void OnPointerClick(PointerEventData eventData)| +|OnPointerDown()||public override void OnPointerDown(PointerEventData eventData)| +|RefreshEndLabelInternal()||public virtual void RefreshEndLabelInternal()| +|RefreshLabelInternal()||public override void RefreshLabelInternal()| +|RefreshLabelNextFrame()||public override void RefreshLabelNextFrame()| +|RemoveComponent()||public override void RemoveComponent()| +|Update()||public override void Update()| ## SerieHandlerAttribute Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| SerieHandlerAttribute() |public SerieHandlerAttribute(Type handler)| -| SerieHandlerAttribute() |public SerieHandlerAttribute(Type handler, bool allowMultiple)| +|public method|since|description| +|--|--|--| +|SerieHandlerAttribute()||public SerieHandlerAttribute(Type handler)| +|SerieHandlerAttribute()||public SerieHandlerAttribute(Type handler, bool allowMultiple)| ## SerieHelper -|public method|description| -|--|--| -| CloneSerie<T>() |public static T CloneSerie<T>(Serie serie) where T : Serie| -| CopySerie() |public static void CopySerie(Serie oldSerie, Serie newSerie)| -| GetAllMinMaxData() |public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)| -| GetAreaStyle() |public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData)| -| GetAverageData() |public static double GetAverageData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetBlurStyle() |public static BlurStyle GetBlurStyle(Serie serie, SerieData serieData)| -| GetEmphasisStyle() |public static EmphasisStyle GetEmphasisStyle(Serie serie, SerieData serieData)| -| GetItemColor() |public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)| -| GetItemFormatter() |public static string GetItemFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)| -| GetItemMarker() |public static string GetItemMarker(Serie serie, SerieData serieData, string defaultMarker = null)| -| GetItemStyle() |public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| -| GetLineColor() |public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto)| -| GetLineStyle() |public static LineStyle GetLineStyle(Serie serie, SerieData serieData)| -| GetMaxData() |public static double GetMaxData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetMaxSerieData() |public static SerieData GetMaxSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetMedianData() |public static double GetMedianData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetMinData() |public static double GetMinData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetMinMaxData() |public static void GetMinMaxData(Serie serie, out double min, out double max, DataZoom dataZoom = null, int dimension = 0)<br/>获得系列所有数据的最大最小值。 | -| GetMinSerieData() |public static SerieData GetMinSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| -| GetNumericFormatter() |public static string GetNumericFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)| -| GetSelectStyle() |public static SelectStyle GetSelectStyle(Serie serie, SerieData serieData)| -| GetSerieLabel() |public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| -| GetSerieLabelLine() |public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| -| GetSerieState() |public static SerieState GetSerieState(Serie serie)| -| GetSerieState() |public static SerieState GetSerieState(Serie serie, SerieData serieData, bool defaultSerieState = false)| -| GetSerieState() |public static SerieState GetSerieState(SerieData serieData)| -| GetSerieSymbol() |public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| -| GetStateStyle() |public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)| -| GetSysmbolSize() |public static float GetSysmbolSize(Serie serie, SerieData serieData, ThemeStyle theme, float defaultSize, SerieState state = SerieState.Auto)| -| GetTitleStyle() |public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData)| -| IsAllZeroValue() |public static bool IsAllZeroValue(Serie serie, int dimension = 1)<br/>系列指定维数的数据是否全部为0。 | -| IsDownPoint() |public static bool IsDownPoint(Serie serie, int index)| -| UpdateCenter() |public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)<br/>更新运行时中心点和半径 | -| UpdateFilterData() |public static void UpdateFilterData(Serie serie, DataZoom dataZoom)<br/>根据dataZoom更新数据列表缓存 | -| UpdateMinMaxData() |public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)<br/>获得指定维数的最大最小值 | -| UpdateRect() |public static void UpdateRect(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)| -| UpdateSerieRuntimeFilterData() |public static void UpdateSerieRuntimeFilterData(Serie serie, bool filterInvisible = true)| +|public method|since|description| +|--|--|--| +|CloneSerie<T>()||public static T CloneSerie<T>(Serie serie) where T : Serie| +|CopySerie()||public static void CopySerie(Serie oldSerie, Serie newSerie)| +|GetAllMinMaxData()||public static void GetAllMinMaxData(Serie serie, double ceilRate = 0, DataZoom dataZoom = null)| +|GetAreaStyle()||public static AreaStyle GetAreaStyle(Serie serie, SerieData serieData)| +|GetAverageData()||public static double GetAverageData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetBlurStyle()||public static BlurStyle GetBlurStyle(Serie serie, SerieData serieData)| +|GetEmphasisStyle()||public static EmphasisStyle GetEmphasisStyle(Serie serie, SerieData serieData)| +|GetItemColor()||public static Color32 GetItemColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto, bool opacity = true)| +|GetItemFormatter()||public static string GetItemFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)| +|GetItemMarker()||public static string GetItemMarker(Serie serie, SerieData serieData, string defaultMarker = null)| +|GetItemStyle()||public static ItemStyle GetItemStyle(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| +|GetLineColor()||public static Color32 GetLineColor(Serie serie, SerieData serieData, ThemeStyle theme, int index, SerieState state = SerieState.Auto)| +|GetLineStyle()||public static LineStyle GetLineStyle(Serie serie, SerieData serieData)| +|GetMaxData()||public static double GetMaxData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetMaxSerieData()||public static SerieData GetMaxSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetMedianData()||public static double GetMedianData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetMinData()||public static double GetMinData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetMinMaxData()||public static void GetMinMaxData(Serie serie, out double min, out double max, DataZoom dataZoom = null, int dimension = 0)<br/>获得系列所有数据的最大最小值。 | +|GetMinSerieData()||public static SerieData GetMinSerieData(Serie serie, int dimension = 1, DataZoom dataZoom = null)| +|GetNumericFormatter()||public static string GetNumericFormatter(Serie serie, SerieData serieData, string defaultFormatter = null)| +|GetSelectStyle()||public static SelectStyle GetSelectStyle(Serie serie, SerieData serieData)| +|GetSerieLabel()||public static LabelStyle GetSerieLabel(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| +|GetSerieLabelLine()||public static LabelLine GetSerieLabelLine(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| +|GetSerieState()||public static SerieState GetSerieState(Serie serie)| +|GetSerieState()||public static SerieState GetSerieState(Serie serie, SerieData serieData, bool defaultSerieState = false)| +|GetSerieState()||public static SerieState GetSerieState(SerieData serieData)| +|GetSerieSymbol()||public static SerieSymbol GetSerieSymbol(Serie serie, SerieData serieData, SerieState state = SerieState.Auto)| +|GetStateStyle()||public static StateStyle GetStateStyle(Serie serie, SerieData serieData, SerieState state)| +|GetSysmbolSize()||public static float GetSysmbolSize(Serie serie, SerieData serieData, ThemeStyle theme, float defaultSize, SerieState state = SerieState.Auto)| +|GetTitleStyle()||public static TitleStyle GetTitleStyle(Serie serie, SerieData serieData)| +|IsAllZeroValue()||public static bool IsAllZeroValue(Serie serie, int dimension = 1)<br/>系列指定维数的数据是否全部为0。 | +|IsDownPoint()||public static bool IsDownPoint(Serie serie, int index)| +|UpdateCenter()||public static void UpdateCenter(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)<br/>更新运行时中心点和半径 | +|UpdateFilterData()||public static void UpdateFilterData(Serie serie, DataZoom dataZoom)<br/>根据dataZoom更新数据列表缓存 | +|UpdateMinMaxData()||public static void UpdateMinMaxData(Serie serie, int dimension, double ceilRate = 0, DataZoom dataZoom = null)<br/>获得指定维数的最大最小值 | +|UpdateRect()||public static void UpdateRect(Serie serie, Vector3 chartPosition, float chartWidth, float chartHeight)| +|UpdateSerieRuntimeFilterData()||public static void UpdateSerieRuntimeFilterData(Serie serie, bool filterInvisible = true)| ## SerieLabelHelper -|public method|description| -|--|--| -| AvoidLabelOverlap() |public static void AvoidLabelOverlap(Serie serie, ComponentTheme theme)| -| CanShowLabel() |public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)| -| GetLabelColor() |public static Color GetLabelColor(Serie serie, ThemeStyle theme, int index)| -| GetRealLabelPosition() |public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)| -| SetGaugeLabelText() |public static void SetGaugeLabelText(Serie serie)| -| UpdatePieLabelPosition() |public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)| +|public method|since|description| +|--|--|--| +|AvoidLabelOverlap()||public static void AvoidLabelOverlap(Serie serie, ComponentTheme theme)| +|CanShowLabel()||public static bool CanShowLabel(Serie serie, SerieData serieData, LabelStyle label, int dimesion)| +|GetLabelColor()||public static Color GetLabelColor(Serie serie, ThemeStyle theme, int index)| +|GetRealLabelPosition()||public static Vector3 GetRealLabelPosition(Serie serie, SerieData serieData, LabelStyle label, LabelLine labelLine)| +|SetGaugeLabelText()||public static void SetGaugeLabelText(Serie serie)| +|UpdatePieLabelPosition()||public static void UpdatePieLabelPosition(Serie serie, SerieData serieData)| ## SerieLabelPool -|public method|description| -|--|--| -| ClearAll() |public static void ClearAll()| -| Release() |public static void Release(GameObject element)| -| ReleaseAll() |public static void ReleaseAll(Transform parent)| +|public method|since|description| +|--|--|--| +|ClearAll()||public static void ClearAll()| +|Release()||public static void Release(GameObject element)| +|ReleaseAll()||public static void ReleaseAll(Transform parent)| ## SerieParams ## SeriesHelper -|public method|description| -|--|--| -| GetLastStackSerie() |public static Serie GetLastStackSerie(List<Serie> series, Serie serie)<br/>获得上一个同堆叠且显示的serie。 | -| GetLegalSerieNameList() |public static List<string> GetLegalSerieNameList(List<Serie> series)| -| GetMaxSerieDataCount() |public static int GetMaxSerieDataCount(List<Serie> series)| -| GetNameColor() |public static Color GetNameColor(BaseChart chart, int index, string name)| -| GetStackSeries() |public static void GetStackSeries(List<Serie> series, ref Dictionary<int, List<Serie>> stackSeries)<br/>获得堆叠系列列表 | -| IsAnyClipSerie() |public static bool IsAnyClipSerie(List<Serie> series)<br/>是否有需裁剪的serie。 | -| IsLegalLegendName() |public static bool IsLegalLegendName(string name)| -| IsPercentStack<T>() |public static bool IsPercentStack<T>(List<Serie> series) where T : Serie<br/>是否时百分比堆叠 | -| IsPercentStack<T>() |public static bool IsPercentStack<T>(List<Serie> series, string stackName) where T : Serie<br/>是否时百分比堆叠 | -| IsStack() |public static bool IsStack(List<Serie> series)<br/>是否由数据堆叠 | -| IsStack<T>() |public static bool IsStack<T>(List<Serie> series, string stackName) where T : Serie<br/>是否堆叠 | -| UpdateSerieNameList() |public static void UpdateSerieNameList(BaseChart chart, ref List<string> serieNameList)<br/>获得所有系列名,不包含空名字。 | -| UpdateStackDataList() |public static void UpdateStackDataList(List<Serie> series, Serie currSerie, DataZoom dataZoom, List<List<SerieData>> dataList)| +|public method|since|description| +|--|--|--| +|GetLastStackSerie()||public static Serie GetLastStackSerie(List<Serie> series, Serie serie)<br/>获得上一个同堆叠且显示的serie。 | +|GetLegalSerieNameList()||public static List<string> GetLegalSerieNameList(List<Serie> series)| +|GetMaxSerieDataCount()||public static int GetMaxSerieDataCount(List<Serie> series)| +|GetNameColor()||public static Color GetNameColor(BaseChart chart, int index, string name)| +|GetStackSeries()||public static void GetStackSeries(List<Serie> series, ref Dictionary<int, List<Serie>> stackSeries)<br/>获得堆叠系列列表 | +|IsAnyClipSerie()||public static bool IsAnyClipSerie(List<Serie> series)<br/>是否有需裁剪的serie。 | +|IsLegalLegendName()||public static bool IsLegalLegendName(string name)| +|IsPercentStack<T>()||public static bool IsPercentStack<T>(List<Serie> series) where T : Serie<br/>是否时百分比堆叠 | +|IsPercentStack<T>()||public static bool IsPercentStack<T>(List<Serie> series, string stackName) where T : Serie<br/>是否时百分比堆叠 | +|IsStack()||public static bool IsStack(List<Serie> series)<br/>是否由数据堆叠 | +|IsStack<T>()||public static bool IsStack<T>(List<Serie> series, string stackName) where T : Serie<br/>是否堆叠 | +|UpdateSerieNameList()||public static void UpdateSerieNameList(BaseChart chart, ref List<string> serieNameList)<br/>获得所有系列名,不包含空名字。 | +|UpdateStackDataList()||public static void UpdateStackDataList(List<Serie> series, Serie currSerie, DataZoom dataZoom, List<List<SerieData>> dataList)| ## SimplifiedBarChart @@ -956,17 +1075,17 @@ Inherits or Implemented: [BaseChart](#basechart) Inherits or Implemented: [Attribute](#attribute) -|public method|description| -|--|--| -| Since() |public Since(string version)| +|public method|since|description| +|--|--|--| +|Since()||public Since(string version)| ## SVG -|public method|description| -|--|--| -| DrawPath() |public static void DrawPath(VertexHelper vh, string path)| -| DrawPath() |public static void DrawPath(VertexHelper vh, SVGPath path)| -| Test() |public static void Test(VertexHelper vh)| +|public method|since|description| +|--|--|--| +|DrawPath()||public static void DrawPath(VertexHelper vh, string path)| +|DrawPath()||public static void DrawPath(VertexHelper vh, SVGPath path)| +|Test()||public static void Test(VertexHelper vh)| ## SVGImage @@ -974,17 +1093,17 @@ Inherits or Implemented: [MaskableGraphic](#maskablegraphic) ## SVGPath -|public method|description| -|--|--| -| AddSegment() |public void AddSegment(SVGPathSeg seg)| -| Draw() |public void Draw(VertexHelper vh)| -| Parse() |public static SVGPath Parse(string path)| +|public method|since|description| +|--|--|--| +|AddSegment()||public void AddSegment(SVGPathSeg seg)| +|Draw()||public void Draw(VertexHelper vh)| +|Parse()||public static SVGPath Parse(string path)| ## SVGPathSeg -|public method|description| -|--|--| -| SVGPathSeg() |public SVGPathSeg(SVGPathSegType type)| +|public method|since|description| +|--|--|--| +|SVGPathSeg()||public SVGPathSeg(SVGPathSegType type)| ## TooltipContext @@ -992,47 +1111,47 @@ Inherits or Implemented: [MaskableGraphic](#maskablegraphic) ## TooltipHelper -|public method|description| -|--|--| -| GetItemNumericFormatter() |public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)| -| GetLineColor() |public static Color32 GetLineColor(Tooltip tooltip, Color32 defaultColor)| -| IsIgnoreFormatter() |public static bool IsIgnoreFormatter(string itemFormatter)| -| LimitInRect() |public static void LimitInRect(Tooltip tooltip, Rect chartRect)| +|public method|since|description| +|--|--|--| +|GetItemNumericFormatter()||public static string GetItemNumericFormatter(Tooltip tooltip, Serie serie, SerieData serieData)| +|GetLineColor()||public static Color32 GetLineColor(Tooltip tooltip, Color32 defaultColor)| +|IsIgnoreFormatter()||public static bool IsIgnoreFormatter(string itemFormatter)| +|LimitInRect()||public static void LimitInRect(Tooltip tooltip, Rect chartRect)| ## TooltipView -|public method|description| -|--|--| -| CreateView() |public static TooltipView CreateView(Tooltip tooltip, ThemeStyle theme, Transform parent)| -| GetCurrentPos() |public Vector3 GetCurrentPos()| -| GetTargetPos() |public Vector3 GetTargetPos()| -| Refresh() |public void Refresh()| -| SetActive() |public void SetActive(bool flag)| -| Update() |public void Update()| -| UpdatePosition() |public void UpdatePosition(Vector3 pos)| +|public method|since|description| +|--|--|--| +|CreateView()||public static TooltipView CreateView(Tooltip tooltip, ThemeStyle theme, Transform parent)| +|GetCurrentPos()||public Vector3 GetCurrentPos()| +|GetTargetPos()||public Vector3 GetTargetPos()| +|Refresh()||public void Refresh()| +|SetActive()||public void SetActive(bool flag)| +|Update()||public void Update()| +|UpdatePosition()||public void UpdatePosition(Vector3 pos)| ## TooltipViewItem ## UGL -|public method|description| -|--|--| -| DrawDiamond() |public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color)<br/>Draw a diamond. 画菱形(钻石形状) | -| DrawDiamond() |public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color, Color32 toColor)<br/>Draw a diamond. 画菱形(钻石形状) | -| DrawEllipse() |public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)| -| DrawLine() |public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)| -| DrawLine() |public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)<br/>Draw a line. 画直线 | -| DrawLine() |public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)<br/>Draw a line. 画直线 | -| DrawPolygon() |public static void DrawPolygon(VertexHelper vh, List<Vector3> points, Color32 color)<br/>填充任意多边形(目前只支持凸多边形) | -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)| -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color, Color32 toColor)| -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color)| -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color, Color32 toColor)| -| DrawRectangle() |public static void DrawRectangle(VertexHelper vh, Vector3 p1, Vector3 p2, float radius, Color32 color)<br/>Draw a rectangle. 画带长方形 | -| DrawSquare() |public static void DrawSquare(VertexHelper vh, Vector3 center, float radius, Color32 color)<br/>Draw a square. 画正方形 | -| DrawSvgPath() |public static void DrawSvgPath(VertexHelper vh, string path)| -| DrawTriangle() |public static void DrawTriangle(VertexHelper vh, Vector3 pos, float size, Color32 color)| -| DrawTriangle() |public static void DrawTriangle(VertexHelper vh, Vector3 pos, float size, Color32 color, Color32 toColor)| +|public method|since|description| +|--|--|--| +|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color)<br/>Draw a diamond. 画菱形(钻石形状) | +|DrawDiamond()||public static void DrawDiamond(VertexHelper vh, Vector3 center, float size, Color32 color, Color32 toColor)<br/>Draw a diamond. 画菱形(钻石形状) | +|DrawEllipse()||public static void DrawEllipse(VertexHelper vh, Vector3 center, float w, float h, Color32 color, float smoothness = 1)| +|DrawLine()||public static void DrawLine(VertexHelper vh, List<Vector3> points, float width, Color32 color, bool smooth, bool closepath = false)| +|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color)<br/>Draw a line. 画直线 | +|DrawLine()||public static void DrawLine(VertexHelper vh, Vector3 startPoint, Vector3 endPoint, float width, Color32 color, Color32 toColor)<br/>Draw a line. 画直线 | +|DrawPolygon()||public static void DrawPolygon(VertexHelper vh, List<Vector3> points, Color32 color)<br/>填充任意多边形(目前只支持凸多边形) | +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color)| +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, Color32 color, Color32 toColor)| +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color)| +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Rect rect, float border, Color32 color, Color32 toColor)| +|DrawRectangle()||public static void DrawRectangle(VertexHelper vh, Vector3 p1, Vector3 p2, float radius, Color32 color)<br/>Draw a rectangle. 画带长方形 | +|DrawSquare()||public static void DrawSquare(VertexHelper vh, Vector3 center, float radius, Color32 color)<br/>Draw a square. 画正方形 | +|DrawSvgPath()||public static void DrawSvgPath(VertexHelper vh, string path)| +|DrawTriangle()||public static void DrawTriangle(VertexHelper vh, Vector3 pos, float size, Color32 color)| +|DrawTriangle()||public static void DrawTriangle(VertexHelper vh, Vector3 pos, float size, Color32 color, Color32 toColor)| ## UGLExample @@ -1040,30 +1159,44 @@ Inherits or Implemented: [MaskableGraphic](#maskablegraphic) ## UGLHelper -|public method|description| -|--|--| -| GetAngle360() |public static float GetAngle360(Vector2 from, Vector2 to)<br/>获得0-360的角度(12点钟方向为0度) | -| GetBezier() |public static Vector3 GetBezier(float t, Vector3 sp, Vector3 cp, Vector3 ep)| -| GetBezier2() |public static Vector3 GetBezier2(float t, Vector3 sp, Vector3 p1, Vector3 p2, Vector3 ep)| -| GetBezierList() |public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)| -| GetDire() |public static Vector3 GetDire(float angle, bool isDegree = false)| -| GetIntersection() |public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref Vector3 intersection)<br/>获得两直线的交点 | -| GetPos() |public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)| -| GetVertialDire() |public static Vector3 GetVertialDire(Vector3 dire)| -| IsClearColor() |public static bool IsClearColor(Color color)| -| IsClearColor() |public static bool IsClearColor(Color32 color)| -| IsPointInPolygon() |public static bool IsPointInPolygon(Vector3 p, List<Vector2> polyons)| -| IsPointInPolygon() |public static bool IsPointInPolygon(Vector3 p, List<Vector3> polyons)| -| IsPointInTriangle() |public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)| -| IsValueEqualsColor() |public static bool IsValueEqualsColor(Color color1, Color color2)| -| IsValueEqualsColor() |public static bool IsValueEqualsColor(Color32 color1, Color32 color2)| -| IsValueEqualsList<T>() |public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)| -| IsValueEqualsString() |public static bool IsValueEqualsString(string str1, string str2)| -| IsValueEqualsVector2() |public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)| -| IsValueEqualsVector3() |public static bool IsValueEqualsVector3(Vector3 v1, Vector2 v2)| -| IsValueEqualsVector3() |public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)| -| IsZeroVector() |public static bool IsZeroVector(Vector3 pos)| -| RotateRound() |public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)| +|public method|since|description| +|--|--|--| +|GetAngle360()||public static float GetAngle360(Vector2 from, Vector2 to)<br/>获得0-360的角度(12点钟方向为0度) | +|GetBezier()||public static Vector3 GetBezier(float t, Vector3 sp, Vector3 cp, Vector3 ep)| +|GetBezier2()||public static Vector3 GetBezier2(float t, Vector3 sp, Vector3 p1, Vector3 p2, Vector3 ep)| +|GetBezierList()||public static List<Vector3> GetBezierList(Vector3 sp, Vector3 ep, int segment, Vector3 cp)| +|GetDire()||public static Vector3 GetDire(float angle, bool isDegree = false)| +|GetIntersection()||public static bool GetIntersection(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 p4, ref Vector3 intersection)<br/>获得两直线的交点 | +|GetPos()||public static Vector3 GetPos(Vector3 center, float radius, float angle, bool isDegree = false)| +|GetVertialDire()||public static Vector3 GetVertialDire(Vector3 dire)| +|IsClearColor()||public static bool IsClearColor(Color color)| +|IsClearColor()||public static bool IsClearColor(Color32 color)| +|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List<Vector2> polyons)| +|IsPointInPolygon()||public static bool IsPointInPolygon(Vector3 p, List<Vector3> polyons)| +|IsPointInTriangle()||public static bool IsPointInTriangle(Vector3 p1, Vector3 p2, Vector3 p3, Vector3 check)| +|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color color1, Color color2)| +|IsValueEqualsColor()||public static bool IsValueEqualsColor(Color32 color1, Color32 color2)| +|IsValueEqualsList<T>()||public static bool IsValueEqualsList<T>(List<T> list1, List<T> list2)| +|IsValueEqualsString()||public static bool IsValueEqualsString(string str1, string str2)| +|IsValueEqualsVector2()||public static bool IsValueEqualsVector2(Vector2 v1, Vector2 v2)| +|IsValueEqualsVector3()||public static bool IsValueEqualsVector3(Vector3 v1, Vector2 v2)| +|IsValueEqualsVector3()||public static bool IsValueEqualsVector3(Vector3 v1, Vector3 v2)| +|IsZeroVector()||public static bool IsZeroVector(Vector3 pos)| +|RotateRound()||public static Vector3 RotateRound(Vector3 position, Vector3 center, Vector3 axis, float angle)| + +## UIComponent + +Inherits or Implemented: [BaseGraph](#basegraph) + +|public method|since|description| +|--|--|--| +|UpdateTheme()||public bool UpdateTheme(ThemeType theme)<br/>切换内置主题。 | + +## UIHelper + +|public method|since|description| +|--|--|--| +|GetBackgroundColor()||public static Color32 GetBackgroundColor(UIComponent component)| ## VisualMapContext @@ -1071,58 +1204,54 @@ Inherits or Implemented: [MainComponentContext](#maincomponentcontext) ## VisualMapHelper -|public method|description| -|--|--| -| AutoSetLineMinMax() |public static void AutoSetLineMinMax(VisualMap visualMap, Serie serie, bool isY, Axis axis, Axis relativedAxis)| -| GetDimension() |public static int GetDimension(VisualMap visualMap, int defaultDimension)| -| IsNeedAreaGradient() |public static bool IsNeedAreaGradient(VisualMap visualMap)| -| IsNeedGradient() |public static bool IsNeedGradient(VisualMap visualMap)| -| IsNeedLineGradient() |public static bool IsNeedLineGradient(VisualMap visualMap)| -| SetMinMax() |public static void SetMinMax(VisualMap visualMap, double min, double max)| +|public method|since|description| +|--|--|--| +|AutoSetLineMinMax()||public static void AutoSetLineMinMax(VisualMap visualMap, Serie serie, bool isY, Axis axis, Axis relativedAxis)| +|GetDimension()||public static int GetDimension(VisualMap visualMap, int defaultDimension)| +|IsNeedAreaGradient()||public static bool IsNeedAreaGradient(VisualMap visualMap)| +|IsNeedGradient()||public static bool IsNeedGradient(VisualMap visualMap)| +|IsNeedLineGradient()||public static bool IsNeedLineGradient(VisualMap visualMap)| +|SetMinMax()||public static void SetMinMax(VisualMap visualMap, double min, double max)| ## XChartsMgr -|public method|description| -|--|--| -| AddChart() |public static void AddChart(BaseChart chart)| -| ContainsChart() |public static bool ContainsChart(BaseChart chart)| -| ContainsChart() |public static bool ContainsChart(string chartName)| -| DisableTextMeshPro() |public static void DisableTextMeshPro()| -| EnableTextMeshPro() |public static void EnableTextMeshPro()| -| GetChart() |public static BaseChart GetChart(string chartName)| -| GetCharts() |public static List<BaseChart> GetCharts(string chartName)| -| GetPackageFullPath() |public static string GetPackageFullPath()| -| GetRepeatChartNameInfo() |public static string GetRepeatChartNameInfo(BaseChart chart, string chartName)| -| IsExistTMPAssembly() |public static bool IsExistTMPAssembly()| -| IsRepeatChartName() |public static bool IsRepeatChartName(BaseChart chart, string chartName = null)| -| ModifyTMPRefence() |public static bool ModifyTMPRefence(bool removeTMP = false)| -| RemoveAllChartObject() |public static void RemoveAllChartObject()| -| RemoveChart() |public static void RemoveChart(string chartName)| +|public method|since|description| +|--|--|--| +|AddChart()||public static void AddChart(BaseChart chart)| +|ContainsChart()||public static bool ContainsChart(BaseChart chart)| +|ContainsChart()||public static bool ContainsChart(string chartName)| +|GetChart()||public static BaseChart GetChart(string chartName)| +|GetCharts()||public static List<BaseChart> GetCharts(string chartName)| +|GetPackageFullPath()||public static string GetPackageFullPath()| +|GetRepeatChartNameInfo()||public static string GetRepeatChartNameInfo(BaseChart chart, string chartName)| +|IsRepeatChartName()||public static bool IsRepeatChartName(BaseChart chart, string chartName = null)| +|RemoveAllChartObject()||public static void RemoveAllChartObject()| +|RemoveChart()||public static void RemoveChart(string chartName)| ## XCResourceImporterWindow Inherits or Implemented: [UnityEditor.EditorWindow](#unityeditor.editorwindow) -|public method|description| -|--|--| -| ShowPackageImporterWindow() |public static void ShowPackageImporterWindow()| +|public method|since|description| +|--|--|--| +|ShowPackageImporterWindow()||public static void ShowPackageImporterWindow()| ## XCThemeMgr -|public method|description| -|--|--| -| AddTheme() |public static void AddTheme(Theme theme)| -| CheckReloadTheme() |public static void CheckReloadTheme()| -| ContainsTheme() |public static bool ContainsTheme(string themeName)| -| ExportTheme() |public static bool ExportTheme(Theme theme)| -| ExportTheme() |public static bool ExportTheme(Theme theme, string themeNewName)| -| GetAllThemeNames() |public static List<string> GetAllThemeNames()| -| GetTheme() |public static Theme GetTheme(string themeName)| -| GetTheme() |public static Theme GetTheme(ThemeType type)| -| GetThemeAssetPath() |public static string GetThemeAssetPath(string themeName)| -| GetThemeList() |public static List<Theme> GetThemeList()| -| LoadTheme() |public static Theme LoadTheme(string themeName)| -| LoadTheme() |public static Theme LoadTheme(ThemeType type)| -| ReloadThemeList() |public static void ReloadThemeList()<br/>重新加载主题列表 | -| SwitchTheme() |public static void SwitchTheme(BaseChart chart, string themeName)| +|public method|since|description| +|--|--|--| +|AddTheme()||public static void AddTheme(Theme theme)| +|CheckReloadTheme()||public static void CheckReloadTheme()| +|ContainsTheme()||public static bool ContainsTheme(string themeName)| +|ExportTheme()||public static bool ExportTheme(Theme theme)| +|ExportTheme()||public static bool ExportTheme(Theme theme, string themeNewName)| +|GetAllThemeNames()||public static List<string> GetAllThemeNames()| +|GetTheme()||public static Theme GetTheme(string themeName)| +|GetTheme()||public static Theme GetTheme(ThemeType type)| +|GetThemeAssetPath()||public static string GetThemeAssetPath(string themeName)| +|GetThemeList()||public static List<Theme> GetThemeList()| +|LoadTheme()||public static Theme LoadTheme(string themeName)| +|LoadTheme()||public static Theme LoadTheme(ThemeType type)| +|ReloadThemeList()||public static void ReloadThemeList()<br/>重新加载主题列表 | +|SwitchTheme()||public static void SwitchTheme(BaseChart chart, string themeName)| diff --git a/Documentation~/zh/changelog.md b/Documentation~/zh/changelog.md index 653a6225..7df3f802 100644 --- a/Documentation~/zh/changelog.md +++ b/Documentation~/zh/changelog.md @@ -1,11 +1,12 @@ --- -sidebar_position: 5 +sidebar_position: 61 slug: /changelog --- # 更新日志 [master](#master) +[v3.6.0](#v360) [v3.5.0](#v350) [v3.4.0](#v340) [v3.3.0](#v330) @@ -65,6 +66,59 @@ slug: /changelog ## master +## v3.6.0 + +版本要点: + +* 增加`InputSystem`支持 (by __Bian-Sh__) +* 增加官网[在线示例](https://xcharts-team.github.io/examples/)多版本支持 (by __SHL-COOL__) +* 完善对`VR`的支持 (by __Ambitroc__) +* 增加`UITable`,`UIStatistic`等[扩展UI组件](https://xcharts-team.github.io/docs/ui) +* 增加`ItemStyle`的`MarkColor` +* 增加通配符`{h}`的支持 +* 优化`Tooltip`,`Legend`,`DataZoom`,`Axis`等组件 +* 重构相关`API`接口,完善回调接口 +* 修复若干问题 + +升级注意: + +* 部分接口有调整,可根据提示更换下接口即可。 + +日志详情: + +* (2023.04.01) 发布`v3.6.0`版本 +* (2023.03.14) 修复`Tooltip`的`titleFormater`设置`{b}`可能不生效的问题 +* (2023.03.14) 修复`BarChart`在数据为0时不绘制柱条背景的问题 (#250) (by __Ambitroc__) +* (2023.03.12) 增加`LabelStyle`的`autoRotate`可设置有角度的竖版文本的自动旋转 +* (2023.03.10) 增加`VR`等其他非鼠标输入方式的Point位置获取 (#248) (by __Ambitroc__) +* (2023.03.09) 增加`Chart`的`onSerieClick`,`onSerieDown`,`onSerieEnter`和`onSerieExit`回调 +* (2023.03.09) 修复`Pie`的点击选中偏移不生效的问题 +* (2023.03.04) 增加`Legend`的`Positions`可自定义图例的位置 +* (2023.03.03) 修复`Animation`变更动画可能无效的问题 +* (2023.02.28) 修复`Legend`点击时`Serie`的`Label`不刷新的问题 +* (2023.02.26) 增加`DataZoom`的`startEndFunction`委托 +* (2023.02.12) 重构`Component`相关代码,调整API接口 +* (2023.02.10) 修复`Axis`在`Log`轴时某些情况下最小值不正确的问题 +* (2023.02.10) 优化`Axis`的数值`Label`的默认显示格式 +* (2023.02.08) 增加`DataZoom`的`startLock`和`endLock`参数支持锁定 +* (2023.02.02) 修复`DataZoom`开启时`X轴`的`Label`可能会显示在图表外的问题 +* (2023.02.02) 优化`SerieData`的`ignore`设置时的忽略数据判断 +* (2023.02.01) 修复`XChartsMgr.ContainsChart()`接口异常 +* (2023.01.31) 增加`InputSystem`的支持 (#242) (by __Bian-Sh__) +* (2023.01.11) 修复`Inspector`上移除`Component`后图表没有及时刷新的问题 (#241) +* (2023.01.06) 修复`Pie`在最后的几个数据都为0时`Label`显示不正常的问题 (#240) +* (2023.01.03) 删除`Serie`的`MarkColor`,增加`ItemStyle`的`MarkColor` +* (2022.12.29) 增加`Editor`对`List`的`+`添加编辑功能 +* (2022.12.29) 修复`UpdateXYData()`接口影响数据精度的问题 (#238) +* (2022.12.28) 修复`Pie`只有一个数据时设置`border`后显示异常的问题 (#237) +* (2022.12.22) 调整`Covert`重命名为`Convert`,涉及的接口有:`ConvertXYAxis()`,`CovertSerie()`等 +* (2022.12.22) 修复`Convert XY Axis`后Y轴的`Label`显示异常的问题 +* (2022.12.12) 修复`Axis`的`Value`轴在某些情况下计算数值范围不准确的问题 +* (2022.12.12) 优化`Legend`的`formatter`支持`{h}`通配符 +* (2022.12.12) 修复`Legend`的`formatter`设置为固定值时显示不正常的问题 +* (2022.12.08) 增加`AreaStyle`的`toTop`参数可设置折线图渐变色是到顶部还是到实际位置 +* (2022.12.07) 增加`Formatter`的文本通配符`{h}`支持设置当前颜色值 + ## v3.5.0 版本要点: @@ -673,7 +727,7 @@ slug: /changelog * (2020.04.19) 优化`LineChart`折线图的区域填充渐变效果 * (2020.04.19) 增加`AxisLabel`的`onZero`参数可将`Label`显示在`0`刻度上 * (2020.04.19) 增加`Serie`和`AxisLabel`的`showAsPositiveNumber`参数将负数数值显示为正数 -* (2020.04.18) 增加`Covert XY Axis`互换XY轴配置 +* (2020.04.18) 增加`Convert XY Axis`互换XY轴配置 * (2020.04.17) 增加`Axis`可通过`inverse`参数设置坐标轴反转 * (2020.04.16) 修复`Check warning`在`Unity2019.3`上的显示问题 * (2020.04.16) 修复`PieChart`在设置`Space`参数后动画绘制异常的问题 diff --git a/Documentation~/zh/configuration.md b/Documentation~/zh/configuration.md index c7719f26..959eb8ad 100644 --- a/Documentation~/zh/configuration.md +++ b/Documentation~/zh/configuration.md @@ -1,5 +1,5 @@ --- -sidebar_position: 2 +sidebar_position: 31 slug: /configuration --- @@ -7,76 +7,176 @@ slug: /configuration ## Serie 系列 -||||| -|--|--|--|--| -|[Bar](#bar)|[BaseScatter](#basescatter)|[Candlestick](#candlestick)|[EffectScatter](#effectscatter)| -|[Heatmap](#heatmap)|[Line](#line)|[Parallel](#parallel)|[Pie](#pie)| -|[Radar](#radar)|[Ring](#ring)|[Scatter](#scatter)|[Serie](#serie)| -|[SimplifiedBar](#simplifiedbar)|[SimplifiedCandlestick](#simplifiedcandlestick)|[SimplifiedLine](#simplifiedline)| +- [Bar](#bar) +- [BaseScatter](#basescatter) +- [Candlestick](#candlestick) +- [EffectScatter](#effectscatter) +- [Heatmap](#heatmap) +- [Line](#line) +- [Parallel](#parallel) +- [Pie](#pie) +- [Radar](#radar) +- [Ring](#ring) +- [Scatter](#scatter) +- [Serie](#serie) +- [SimplifiedBar](#simplifiedbar) +- [SimplifiedCandlestick](#simplifiedcandlestick) +- [SimplifiedLine](#simplifiedline) + ## Theme 主题 -||||| -|--|--|--|--| -|[AngleAxisTheme](#angleaxistheme)|[AxisTheme](#axistheme)|[BaseAxisTheme](#baseaxistheme)|[ComponentTheme](#componenttheme)| -|[DataZoomTheme](#datazoomtheme)|[LegendTheme](#legendtheme)|[PolarAxisTheme](#polaraxistheme)|[RadarAxisTheme](#radaraxistheme)| -|[RadiusAxisTheme](#radiusaxistheme)|[SerieTheme](#serietheme)|[SubTitleTheme](#subtitletheme)|[Theme](#theme)| -|[ThemeStyle](#themestyle)|[TitleTheme](#titletheme)|[TooltipTheme](#tooltiptheme)|[VisualMapTheme](#visualmaptheme)| +- [AngleAxisTheme](#angleaxistheme) +- [AxisTheme](#axistheme) +- [BaseAxisTheme](#baseaxistheme) +- [ComponentTheme](#componenttheme) +- [DataZoomTheme](#datazoomtheme) +- [LegendTheme](#legendtheme) +- [PolarAxisTheme](#polaraxistheme) +- [RadarAxisTheme](#radaraxistheme) +- [RadiusAxisTheme](#radiusaxistheme) +- [SerieTheme](#serietheme) +- [SubTitleTheme](#subtitletheme) +- [Theme](#theme) +- [ThemeStyle](#themestyle) +- [TitleTheme](#titletheme) +- [TooltipTheme](#tooltiptheme) +- [UIComponentTheme](#uicomponenttheme) +- [VisualMapTheme](#visualmaptheme) + ## MainComponent 主组件 -||||| -|--|--|--|--| -|[AngleAxis](#angleaxis)|[Axis](#axis)|[Background](#background)|[CalendarCoord](#calendarcoord)| -|[Comment](#comment)|[CoordSystem](#coordsystem)|[DataZoom](#datazoom)|[GridCoord](#gridcoord)| -|[Legend](#legend)|[MarkArea](#markarea)|[MarkLine](#markline)|[ParallelAxis](#parallelaxis)| -|[ParallelCoord](#parallelcoord)|[PolarCoord](#polarcoord)|[RadarCoord](#radarcoord)|[RadiusAxis](#radiusaxis)| -|[Settings](#settings)|[SingleAxis](#singleaxis)|[SingleAxisCoord](#singleaxiscoord)|[Title](#title)| -|[Tooltip](#tooltip)|[VisualMap](#visualmap)|[XAxis](#xaxis)|[YAxis](#yaxis)| +- [AngleAxis](#angleaxis) +- [Axis](#axis) +- [Background](#background) +- [CalendarCoord](#calendarcoord) +- [Comment](#comment) +- [CoordSystem](#coordsystem) +- [DataZoom](#datazoom) +- [GridCoord](#gridcoord) +- [Legend](#legend) +- [MarkArea](#markarea) +- [MarkLine](#markline) +- [ParallelAxis](#parallelaxis) +- [ParallelCoord](#parallelcoord) +- [PolarCoord](#polarcoord) +- [RadarCoord](#radarcoord) +- [RadiusAxis](#radiusaxis) +- [Settings](#settings) +- [SingleAxis](#singleaxis) +- [SingleAxisCoord](#singleaxiscoord) +- [Title](#title) +- [Tooltip](#tooltip) +- [VisualMap](#visualmap) +- [XAxis](#xaxis) +- [YAxis](#yaxis) + ## ChildComponent 子组件 -||||| -|--|--|--|--| -|[AngleAxisTheme](#angleaxistheme)|[AnimationStyle](#animationstyle)|[AreaStyle](#areastyle)|[ArrowStyle](#arrowstyle)| -|[AxisLabel](#axislabel)|[AxisLine](#axisline)|[AxisMinorSplitLine](#axisminorsplitline)|[AxisMinorTick](#axisminortick)| -|[AxisName](#axisname)|[AxisSplitArea](#axissplitarea)|[AxisSplitLine](#axissplitline)|[AxisTheme](#axistheme)| -|[AxisTick](#axistick)|[BaseAxisTheme](#baseaxistheme)|[BaseLine](#baseline)|[BlurStyle](#blurstyle)| -|[CommentItem](#commentitem)|[CommentMarkStyle](#commentmarkstyle)|[ComponentTheme](#componenttheme)|[DataZoomTheme](#datazoomtheme)| -|[EmphasisStyle](#emphasisstyle)|[EndLabelStyle](#endlabelstyle)|[IconStyle](#iconstyle)|[ImageStyle](#imagestyle)| -|[ItemStyle](#itemstyle)|[LabelLine](#labelline)|[LabelStyle](#labelstyle)|[LegendTheme](#legendtheme)| -|[Level](#level)|[LevelStyle](#levelstyle)|[LineArrow](#linearrow)|[LineStyle](#linestyle)| -|[Location](#location)|[MarkAreaData](#markareadata)|[MarkLineData](#marklinedata)|[MarqueeStyle](#marqueestyle)| -|[Padding](#padding)|[PolarAxisTheme](#polaraxistheme)|[RadarAxisTheme](#radaraxistheme)|[RadiusAxisTheme](#radiusaxistheme)| -|[SelectStyle](#selectstyle)|[SerieData](#seriedata)|[SerieSymbol](#seriesymbol)|[SerieTheme](#serietheme)| -|[StageColor](#stagecolor)|[StateStyle](#statestyle)|[SubTitleTheme](#subtitletheme)|[SymbolStyle](#symbolstyle)| -|[TextLimit](#textlimit)|[TextPadding](#textpadding)|[TextStyle](#textstyle)|[ThemeStyle](#themestyle)| -|[TitleStyle](#titlestyle)|[TitleTheme](#titletheme)|[TooltipTheme](#tooltiptheme)|[VisualMapRange](#visualmaprange)| -|[VisualMapTheme](#visualmaptheme)| +- [AngleAxisTheme](#angleaxistheme) +- [AnimationStyle](#animationstyle) +- [AreaStyle](#areastyle) +- [ArrowStyle](#arrowstyle) +- [AxisLabel](#axislabel) +- [AxisLine](#axisline) +- [AxisMinorSplitLine](#axisminorsplitline) +- [AxisMinorTick](#axisminortick) +- [AxisName](#axisname) +- [AxisSplitArea](#axissplitarea) +- [AxisSplitLine](#axissplitline) +- [AxisTheme](#axistheme) +- [AxisTick](#axistick) +- [BaseAxisTheme](#baseaxistheme) +- [BaseLine](#baseline) +- [BlurStyle](#blurstyle) +- [CommentItem](#commentitem) +- [CommentMarkStyle](#commentmarkstyle) +- [ComponentTheme](#componenttheme) +- [DataZoomTheme](#datazoomtheme) +- [EmphasisStyle](#emphasisstyle) +- [EndLabelStyle](#endlabelstyle) +- [IconStyle](#iconstyle) +- [ImageStyle](#imagestyle) +- [ItemStyle](#itemstyle) +- [LabelLine](#labelline) +- [LabelStyle](#labelstyle) +- [LegendTheme](#legendtheme) +- [Level](#level) +- [LevelStyle](#levelstyle) +- [LineArrow](#linearrow) +- [LineStyle](#linestyle) +- [Location](#location) +- [MarkAreaData](#markareadata) +- [MarkLineData](#marklinedata) +- [MarqueeStyle](#marqueestyle) +- [Padding](#padding) +- [PolarAxisTheme](#polaraxistheme) +- [RadarAxisTheme](#radaraxistheme) +- [RadiusAxisTheme](#radiusaxistheme) +- [SelectStyle](#selectstyle) +- [SerieData](#seriedata) +- [SerieSymbol](#seriesymbol) +- [SerieTheme](#serietheme) +- [StageColor](#stagecolor) +- [StateStyle](#statestyle) +- [SubTitleTheme](#subtitletheme) +- [SymbolStyle](#symbolstyle) +- [TextLimit](#textlimit) +- [TextPadding](#textpadding) +- [TextStyle](#textstyle) +- [ThemeStyle](#themestyle) +- [TitleStyle](#titlestyle) +- [TitleTheme](#titletheme) +- [TooltipTheme](#tooltiptheme) +- [UIComponentTheme](#uicomponenttheme) +- [VisualMapRange](#visualmaprange) +- [VisualMapTheme](#visualmaptheme) -## ISerieExtraComponent 系列的额外组件 -||||| -|--|--|--|--| -|[AreaStyle](#areastyle)|[BlurStyle](#blurstyle)|[EmphasisStyle](#emphasisstyle)|[ImageStyle](#imagestyle)| -|[LabelLine](#labelline)|[LabelStyle](#labelstyle)|[LineArrow](#linearrow)|[SelectStyle](#selectstyle)| -|[TitleStyle](#titlestyle)| +## ISerieComponent 可添加到Serie的组件 -## ISerieDataComponent 数据项的额外组件 +- [AreaStyle](#areastyle) +- [BlurStyle](#blurstyle) +- [EmphasisStyle](#emphasisstyle) +- [ImageStyle](#imagestyle) +- [LabelLine](#labelline) +- [LabelStyle](#labelstyle) +- [LineArrow](#linearrow) +- [SelectStyle](#selectstyle) +- [TitleStyle](#titlestyle) + + +## ISerieDataComponent 可添加到SerieData的组件 + +- [AreaStyle](#areastyle) +- [BlurStyle](#blurstyle) +- [EmphasisStyle](#emphasisstyle) +- [ImageStyle](#imagestyle) +- [ItemStyle](#itemstyle) +- [LabelLine](#labelline) +- [LabelStyle](#labelstyle) +- [LineStyle](#linestyle) +- [SelectStyle](#selectstyle) +- [SerieSymbol](#seriesymbol) +- [TitleStyle](#titlestyle) -||||| -|--|--|--|--| -|[AreaStyle](#areastyle)|[BlurStyle](#blurstyle)|[EmphasisStyle](#emphasisstyle)|[ImageStyle](#imagestyle)| -|[ItemStyle](#itemstyle)|[LabelLine](#labelline)|[LabelStyle](#labelstyle)|[LineStyle](#linestyle)| -|[SelectStyle](#selectstyle)|[SerieSymbol](#seriesymbol)|[TitleStyle](#titlestyle)| ## Other 其他组件 -||||| -|--|--|--|--| -|[BaseSerie](#baseserie)|[ChartText](#charttext)|[ChildComponent](#childcomponent)|[DebugInfo](#debuginfo)| -|[Indicator](#indicator)|[Lang](#lang)|[LangCandlestick](#langcandlestick)|[LangTime](#langtime)| -|[MainComponent](#maincomponent)|[XCResourcesImporter](#xcresourcesimporter)|[XCSettings](#xcsettings)| +- [BaseSerie](#baseserie) +- [ChartText](#charttext) +- [ChildComponent](#childcomponent) +- [DebugInfo](#debuginfo) +- [Indicator](#indicator) +- [Lang](#lang) +- [LangCandlestick](#langcandlestick) +- [LangTime](#langtime) +- [MainComponent](#maincomponent) +- [XCResourcesImporter](#xcresourcesimporter) +- [XCSettings](#xcsettings) + ## AngleAxis @@ -116,7 +216,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent) ## AreaStyle -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) 区域填充样式。 @@ -128,6 +228,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent |toColor|||渐变色的终点颜色。 |opacity|0.6f||图形透明度。支持从 0 到 1 的数字,为 0 时不绘制该图形。 |innerFill||v3.2.0|是否只填充多边形区域。目前只支持凸多边形。 +|toTop|true|v3.6.0|渐变色是到顶部还是到实际位置。默认为true到顶部。 ## ArrowStyle @@ -354,7 +455,7 @@ Inherits or Implemented: [Serie](#serie),[INeedSerieContainer](#ineedseriecontai ## BlurStyle -Inherits or Implemented: [StateStyle](#statestyle),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [StateStyle](#statestyle),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) > 从 `v3.2.0` 开始支持 @@ -473,6 +574,8 @@ DataZoom 组件 用于区域缩放,从而能自由关注细节的数据信息 |lineStyle|||阴影线条样式。 [LineStyle](#linestyle)| |areaStyle|||阴影填充样式。 [AreaStyle](#areastyle)| |marqueeStyle||v3.5.0|选取框样式。 [MarqueeStyle](#marqueestyle)| +|startLock||v3.6.0|固定起始值,不让改变。 +|endLock||v3.6.0|固定结束值,不让改变。 ## DataZoomTheme @@ -505,7 +608,7 @@ Inherits or Implemented: [BaseScatter](#basescatter) ## EmphasisStyle -Inherits or Implemented: [StateStyle](#statestyle),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [StateStyle](#statestyle),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) > 从 `v3.2.0` 开始支持 @@ -567,7 +670,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent) ## ImageStyle -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) |field|default|since|comment| |--|--|--|--| @@ -622,6 +725,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieDataComponent] |color0|||数据项颜色。 |toColor|||渐变色的颜色1。 |toColor2|||渐变色的颜色2。只在折线图中有效。 +|markColor||v3.6.0|Serie的标识颜色。仅用于Legend和Tooltip的展示,不影响绘制颜色,默认为clear。 |backgroundColor|||数据项背景颜色。 |backgroundWidth|||数据项背景宽度。 |centerColor|||中心区域颜色。 @@ -639,7 +743,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieDataComponent] ## LabelLine -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) 标签的引导线 @@ -658,7 +762,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent ## LabelStyle -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) 图形上的文本标签,可用于说明图形的一些数据信息,比如值,名称等。 @@ -669,6 +773,7 @@ Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent |autoOffset|false||是否开启自动偏移。当开启时,Y的偏移会自动判断曲线的开口来决定向上还是向下偏移。 |offset|||距离图形元素的偏移 |rotate|||文本的旋转。 +|autoRotate|false|v3.6.0|是否自动旋转。 |distance|||距离轴线的距离。 |formatter|||标签内容字符串模版格式器。支持用 \n 换行。 模板变量有: {.}:圆点标记。 {a}:系列名。 {a}:系列名。 {b}:类目值或数据名。 {c}:数据值。 {d}:百分比。 {e}:数据名。 {f}:数据和。 示例:“{b}:{c}” |numericFormatter|||标准数字格式字符串。用于将数值格式化显示为字符串。 使用Axx的形式:A是格式说明符的单字符,支持C货币、D十进制、E指数、F定点数、G常规、N数字、P百分比、R往返、X十六进制的。xx是精度说明,从0-99。 参考:https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings @@ -718,6 +823,7 @@ Inherits or Implemented: [MainComponent](#maincomponent),[IPropertyChanged](#ipr |colors|||图例标记的颜色列表。 |background||v3.1.0|背景图样式。 [ImageStyle](#imagestyle)| |padding||v3.1.0|图例标记和背景的间距。 [Padding](#padding)| +|positions||v3.6.0|图例标记的自定义位置列表。 ## LegendTheme @@ -753,7 +859,7 @@ Inherits or Implemented: [Serie](#serie),[INeedSerieContainer](#ineedseriecontai ## LineArrow -Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieExtraComponent](#iserieextracomponent) +Inherits or Implemented: [ChildComponent](#childcomponent),[ISerieComponent](#iseriecomponent) |field|default|since|comment| |--|--|--|--| @@ -986,7 +1092,7 @@ Inherits or Implemented: [BaseScatter](#basescatter) ## SelectStyle -Inherits or Implemented: [StateStyle](#statestyle),[ISerieExtraComponent](#iserieextracomponent),[ISerieDataComponent](#iseriedatacomponent) +Inherits or Implemented: [StateStyle](#statestyle),[ISerieComponent](#iseriecomponent),[ISerieDataComponent](#iseriedatacomponent) > 从 `v3.2.0` 开始支持 @@ -1008,7 +1114,6 @@ Inherits or Implemented: [BaseSerie](#baseserie),[IComparable](#icomparable) |serieName|||系列名称,用于 tooltip 的显示,legend 的图例筛选。 |state||v3.2.0|系列的默认状态。<br/>`SerieState`:<br/>- `Normal`: 正常状态。<br/>- `Emphasis`: 高亮状态。<br/>- `Blur`: 淡出状态。<br/>- `Select`: 选中状态。<br/>- `Auto`: 自动保持和父节点一致。一般用在SerieData。<br/>| |colorBy||v3.2.0|从主题中取色的策略。<br/>`SerieColorBy`:<br/>- `Default`: 默认策略。每种Serie都有自己的默认的取颜色策略。比如Line默认是Series策略,Pie默认是Data策略<br/>- `Serie`: 按照系列分配调色盘中的颜色,同一系列中的所有数据都是用相同的颜色。<br/>- `Data`: 按照数据项分配调色盘中的颜色,每个数据项都使用不同的颜色。<br/>| -|markColor||v3.4.0|Serie的标识颜色。仅用于Legend和Tooltip的展示,不影响绘制颜色,默认为clear。 |stack|||数据堆叠,同个类目轴上系列配置相同的stack值后,后一个系列的值会在前一个系列的值上相加。 |xAxisIndex|0||使用X轴的index。 |yAxisIndex|0||使用Y轴的index。 @@ -1024,7 +1129,7 @@ Inherits or Implemented: [BaseSerie](#baseserie),[IComparable](#icomparable) |sampleType|||采样类型。当sampleDist大于0时有效。<br/>`SampleType`:<br/>- `Peak`: 取峰值。<br/>- `Average`: 取过滤点的平均值。<br/>- `Max`: 取过滤点的最大值。<br/>- `Min`: 取过滤点的最小值。<br/>- `Sum`: 取过滤点的和。<br/>| |sampleAverage|0||设定的采样平均值。当sampleType 为 Peak 时,用于和过滤数据的平均值做对比是取最大值还是最小值。默认为0时会实时计算所有数据的平均值。 |lineType|||折线图样式类型。<br/>`LineType`:<br/>- `Normal`: 普通折线图。<br/>- `Smooth`: 平滑曲线。<br/>- `StepStart`: 阶梯线图:当前点。<br/>- `StepMiddle`: 阶梯线图:当前点和下一个点的中间。<br/>- `StepEnd`: 阶梯线图:下一个拐点。<br/>| -|smoothLimit|true|v3.4.0|是否限制曲线。当为true时,两个连续相同数值的数据间的曲线会限制为不超出数据点,和数据点是平直的。 +|smoothLimit|false|v3.4.0|是否限制曲线。当为true时,两个连续相同数值的数据间的曲线会限制为不超出数据点,和数据点是平直的。 |barType|||柱形图类型。<br/>`BarType`:<br/>- `Normal`: 普通柱形图。<br/>- `Zebra`: 斑马柱形图。<br/>- `Capsule`: 胶囊柱形图。<br/>| |barPercentStack|false||柱形图是否为百分比堆积。相同stack的serie只要有一个barPercentStack为true,则就显示成百分比堆叠柱状图。 |barWidth|0||柱条的宽度,不设时自适应。支持设置成相对于类目宽度的百分比。 @@ -1341,7 +1446,7 @@ Inherits or Implemented: [MainComponent](#maincomponent),[IPropertyChanged](#ipr ## TitleStyle -Inherits or Implemented: [LabelStyle](#labelstyle),[ISerieDataComponent](#iseriedatacomponent),[ISerieExtraComponent](#iserieextracomponent) +Inherits or Implemented: [LabelStyle](#labelstyle),[ISerieDataComponent](#iseriedatacomponent),[ISerieComponent](#iseriecomponent) 标题相关设置。 @@ -1364,7 +1469,7 @@ Inherits or Implemented: [MainComponent](#maincomponent) |trigger|||触发类型。<br/>`Tooltip.Trigger`:<br/>- `Item`: 数据项图形触发,主要在散点图,饼图等无类目轴的图表中使用。<br/>- `Axis`: 坐标轴触发,主要在柱状图,折线图等会使用类目轴的图表中使用。<br/>- `None`: 什么都不触发。<br/>| |position||v3.3.0|显示位置类型。<br/>`Tooltip.Position`:<br/>- `Auto`: 自适应。移动平台靠顶部显示,非移动平台跟随鼠标位置。<br/>- `Custom`: 自定义。完全自定义显示位置(x,y)。<br/>- `FixedX`: 只固定坐标X。Y跟随鼠标位置。<br/>- `FixedY`: <br/>| |itemFormatter|||提示框单个serie或数据项内容的字符串模版格式器。支持用 \n 换行。用 -|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。<br/> {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。<br/> {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}" +|titleFormatter|||提示框标题内容的字符串模版格式器。支持用 \n 换行。可以单独设置占位符{i}表示忽略不显示title。 模板变量有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。<br/> {.}为当前所指示或index为0的serie的对应颜色的圆点。<br/> {a}为当前所指示或index为0的serie的系列名name。<br/> {b}为当前所指示或index为0的serie的数据项serieData的name,或者类目值(如折线图的X轴)。<br/> {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。<br/> {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。<br/> {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> {f}为数据总和。<br/> {g}为数据总个数。<br/> {.1}表示指定index为1的serie对应颜色的圆点。<br/> {a1}、{b1}、{c1}中的1表示指定index为1的serie。<br/> {c1:2}表示索引为1的serie的当前指示数据项的第3个数据(一个数据项有多个数据,index为2表示第3个数据)。<br/> {c1:2-2}表示索引为1的serie的第3个数据项的第3个数据(也就是要指定第几个数据项时必须要指定第几个数据)。<br/> {d1:2:f2}表示单独指定了数值的格式化字符串为f2(不指定时用numericFormatter)。<br/> {d:0.##} 表示单独指定了数值的格式化字符串为 0.## (用于百分比,保留2位有效数同时又能避免使用 f2 而出现的类似于"100.00%"的情况 )。<br/> 示例:"{a}:{c}"、"{a1}:{c1:f1}"、"{a1}:{c1:0:f1}"、"{a1}:{c1:1-1:f1}" |marker|||serie的符号标志。 |fixedWidth|0||固定宽度。比 minWidth 优先。 |fixedHeight|0||固定高度。比 minHeight 优先。 @@ -1404,6 +1509,16 @@ Inherits or Implemented: [ComponentTheme](#componenttheme) |labelTextColor|||十字指示器坐标轴标签的文本颜色。 |labelBackgroundColor|||十字指示器坐标轴标签的背景颜色。 +## UIComponentTheme + +Inherits or Implemented: [ChildComponent](#childcomponent) + +|field|default|since|comment| +|--|--|--|--| +|show|true|| +|sharedTheme|||主题配置。 [Theme](#theme)| +|transparentBackground|false|| + ## VisualMap Inherits or Implemented: [MainComponent](#maincomponent) diff --git a/Documentation~/zh/faq.md b/Documentation~/zh/faq.md index 666238c1..51054ce8 100644 --- a/Documentation~/zh/faq.md +++ b/Documentation~/zh/faq.md @@ -1,5 +1,5 @@ --- -sidebar_position: 4 +sidebar_position: 41 slug: /faq --- diff --git a/Documentation~/zh/support.md b/Documentation~/zh/support.md index bbe7f59e..c7bdbe71 100644 --- a/Documentation~/zh/support.md +++ b/Documentation~/zh/support.md @@ -1,26 +1,28 @@ --- -sidebar_position: 6 +title: 订阅服务 +sidebar_position: 51 slug: /support --- # 订阅服务 -如需技术支持,可订阅`个人VIP`服务。扫后面的二维码后可加VIP群`867291970`,验证信息请输入付费的账号。 +如需技术支持,可订阅`个人VIP`服务。扫后面的二维码付费后可加VIP群`867291970`,验证信息请输入付费的账号。 企业商务合作可联系QQ:3525422251(XCharts技术支持)。 ## 订阅VIP服务 -订阅服务分个人订阅和企业订阅: +订阅服务分`个人订阅`和`企业订阅`: -- `个人`订阅:`个人VIP`属于个人,不可转让,`XCharts`团队只服务于订阅当事人。 -- `企业`订阅:`企业VIP`属于企业,席位内可安排固定职员,职员离职后席位可重新安排,`XCharts`团队通过专属企业群为企业服务。 +- `个人订阅`:`个人VIP`属于个人,不可转让,`XCharts`团队只服务于订阅当事人。 +- `企业订阅`:`企业VIP`属于企业,席位内可安排固定职员,职员离职后席位可重新安排,`XCharts`团队通过专属企业群为企业服务。 -订阅服务的优势? +订阅服务有哪些优势? -- 提高工作效率,节省时间成本。一方面,`XCharts`功能强大,相关配置项非常多,`VIP`服务可快速帮您定位,节省去查找和核对的时间;另一方面,`VIP`的即时回答服务可快速为您答疑解惑,避免中断开发流程。总之,订阅`VIP`可让您能快速上手,快速处理问题,至少能提高`10`倍以上的工作效率。 +- 提高工作效率,节省时间成本。一方面,`XCharts`功能强大,相关配置项非常多,`VIP`服务可快速帮您定位,节省去查找和核对的时间;另一方面,`VIP`的即时回答服务可快速为您答疑解惑,避免中断开发流程,快速上手,快速处理问题,至少能提高`10`倍以上的工作效率。 - 更多技术交流,更多经验交流。`XCharts`团队成员从业多年,有丰富的技术和工作经验。`VIP`服务不仅可以交流`XCharts`相关的内容,也可以咨询其他方面的技术。`VIP`群也有更多的交流。 -- 扩展图表的需要订阅`VIP`服务后才能购买,扩展图表超过1年后的更新支持也需要持续订阅`VIP`服务。 -- `VIP`用户可加入`XCharts`的`GitHub`组织,参与`XCharts`社区构建,访问专有仓库。 +- 扩展图表需要订阅`VIP`服务后才能购买,扩展图表超过1年后的更新支持也需要持续订阅`VIP`服务。 +- `VIP`用户可加入`XCharts`的`GitHub`组织,参与`XCharts`的社区构建,访问专有仓库。拥有`扩展UI组件`等专属功能。 +- 在`XCharts交流群`里拥有`VIP`专属标识,问题会第一时间得到响应,有问即答。 | |免费用户|付费咨询|个人`VIP` | 个人`SVIP` | 企业`VIP` | | ----- |--|--|--|--|--| @@ -34,8 +36,7 @@ slug: /support | __`服务内容:`__| | 可商用 | √ | √ | √ | √ | √ | | 可二次开发 | √ | √ | √ | √ | √ | -| 有问必答 | | √ | √ | √ | √ | -| 即时回答 | | √ | √ | √ | √ | +| 有问即答 | | √ | √ | √ | √ | | 新手指导 | | √ | √ | √ | √ | | 开发指导 | | √ | √ | √ | √ | | 优化指导 | | √ | √ | √ | √ | @@ -44,7 +45,7 @@ slug: /support | 需求优先考虑 | | | √ | √ | √ | | 可另付费定制 | | | √ | √ | √ | | 可另付费加急 | | | √ | √ | √ | -| VIP专有功能教程和文档 | | | √待开放 | √待开放 | √待开放 | +| 扩展UI组件 | | | √ | √ | √ | | 扩展图表购买 | | | 按需购买 | __全部免费__ | __全部免费__ | | 扩展图表源码 | | | 永久持有 | 永久持有 | 永久持有 | | 扩展图表更新 | | | 1年更新支持 | 1年更新支持 | 1年更新支持 | @@ -53,7 +54,7 @@ slug: /support 扩展图表为另付费购买图表,只对订阅了`VIP`服务的用户开放购买。对于`SVIP`的订阅用户,所有扩展图表仓库可免费使用,不用再单独购买。 -对所有已购买的扩展图表,源码可永久持有,并获得持续一年的更新支持,一年后如需更新支持服务,可继续订阅`VIP`服务。 +对所有已购买的扩展图表,源码可永久持有,并获得持续一年的更新支持,一年后如需更新支持服务,可再继续订阅`VIP`服务。 |编号|扩展图表|价格|备注| |--|--|--|--| @@ -70,13 +71,17 @@ slug: /support ## 备注说明 1. __`付费定制`__ 是指用户可根据自己的需求定制不同的图表或新功能,只有`VIP`用户才享有`付费定制`权利。 -2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并可要求在`Deadline`内交付,只有`VIP`用户才享有`付费加急`权利。 +2. __`付费加急`__ 是指用户可对自己非常紧急的需求进行付费,将开发优先级提到最高,并可要求在指定`截止日期`内交付,只有`VIP`用户才享有`付费加急`权利。 3. __`付费咨询`__ 付费咨询有效期`7`天,且总咨询时长不超过`7`个小时。 -4. __`扩展图表`__ 购买后代码可永久持有和商用,1年的更新支持。 +4. __`扩展图表`__ 购买后代码可永久持有和商用,1年的更新和技术支持。 ## 捐助支持 -如果这个项目对您有帮助,请右上方点 `Star` 予以支持!也欢迎任意金额的捐助,非常您的支持! +如果这个项目对您有帮助,请右上方点 `Star` 予以支持!也欢迎任意金额的捐助,非常感谢您的支持! + +## 二维码 + +如果看不到二维码图片,可以加QQ`XCharts技术支持:3525422251`或邮件`monitor1394@gmail.com`咨询。 ![alipay-qrcode](img/support_alipay.png) ![wechat-qrcode](img/support_wechat.png) diff --git a/Documentation~/zh/tutorial01.md b/Documentation~/zh/tutorial01.md index 3d027094..855cac94 100644 --- a/Documentation~/zh/tutorial01.md +++ b/Documentation~/zh/tutorial01.md @@ -1,6 +1,6 @@ --- title: 入门教程:5分钟上手 XCharts 3.0 -sidebar_position: 1 +sidebar_position: 11 slug: /tutorial01 --- @@ -105,29 +105,29 @@ chart.SetSize(580, 300);//代码动态设置尺寸,或直接操作chart.rectTr 设置标题: ```C# -var title = chart.GetOrAddChartComponent<Title>(); +var title = chart.EnsureChartComponent<Title>(); title.text = "Simple Line"; ``` 设置提示框和图例是否显示: ```C# -var tooltip = chart.GetOrAddChartComponent<Tooltip>(); +var tooltip = chart.EnsureChartComponent<Tooltip>(); tooltip.show = true; -var legend = chart.GetOrAddChartComponent<Legend>(); +var legend = chart.EnsureChartComponent<Legend>(); legend.show = false; ``` 设置坐标轴: ```C# -var xAxis = chart.GetOrAddChartComponent<XAxis>(); +var xAxis = chart.EnsureChartComponent<XAxis>(); xAxis.splitNumber = 10; xAxis.boundaryGap = true; xAxis.type = Axis.AxisType.Category; -var yAxis = chart.GetOrAddChartComponent<YAxis>(); +var yAxis = chart.EnsureChartComponent<YAxis>(); yAxis.type = Axis.AxisType.Value; ``` @@ -201,11 +201,11 @@ XCharts支持TextMeshPro,但默认是不开启的,需要自己手动切换 需要先获取组件,再修改里面的参数: ```C# -var title = chart.GetOrAddChartComponent<Title>(); +var title = chart.EnsureChartComponent<Title>(); title.text = "Simple LineChart"; title.subText = "normal line"; -var xAxis = chart.GetOrAddChartComponent<XAxis>(); +var xAxis = chart.EnsureChartComponent<XAxis>(); xAxis.splitNumber = 10; xAxis.boundaryGap = true; xAxis.type = Axis.AxisType.Category; @@ -240,9 +240,9 @@ serie.roundCap = true; 给Serie添加额外组件: ```C# -serie.AddExtraComponent<AreaStyle>(); +serie.EnsureComponent<AreaStyle>(); -var label = serie1.AddExtraComponent<LabelStyle>(); +var label = serie1.EnsureComponent<LabelStyle>(); label.offset = new Vector3(0,20,0); ``` @@ -253,7 +253,7 @@ var serieData = chart.AddData(0, 20); //var serieData = serie.GetSerieData(0); //从已有数据中获取 serieData.radius = 10; -var itemStyle = serieData.GetOrAddComponent<ItemStyle>(); //给数据项添加ItemStyle组件 +var itemStyle = serieData.EnsureComponent<ItemStyle>(); //给数据项添加ItemStyle组件 itemStyle.color = Color.blue; ``` diff --git a/Editor/Charts/BaseChartEditor.cs b/Editor/Charts/BaseChartEditor.cs index fc9f39d7..665e78f7 100644 --- a/Editor/Charts/BaseChartEditor.cs +++ b/Editor/Charts/BaseChartEditor.cs @@ -14,7 +14,7 @@ namespace XCharts.Editor { public static readonly GUIContent btnAddSerie = new GUIContent("Add Serie", ""); public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", ""); - public static readonly GUIContent btnCovertXYAxis = new GUIContent("Covert XY Axis", ""); + public static readonly GUIContent btnConvertXYAxis = new GUIContent("Convert XY Axis", ""); public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Chart Object", ""); public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", ""); public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", ""); @@ -273,8 +273,8 @@ namespace XCharts.Editor { if (m_Chart.HasChartComponent<XAxis>() && m_Chart.HasChartComponent<YAxis>()) { - if (GUILayout.Button(Styles.btnCovertXYAxis)) - m_Chart.CovertXYAxis(0); + if (GUILayout.Button(Styles.btnConvertXYAxis)) + m_Chart.ConvertXYAxis(0); } if (GUILayout.Button(Styles.btnRebuildChartObject)) { diff --git a/Editor/ChildComponents/AreaStyleDrawer.cs b/Editor/ChildComponents/AreaStyleDrawer.cs index d26457fd..e5e8c80c 100644 --- a/Editor/ChildComponents/AreaStyleDrawer.cs +++ b/Editor/ChildComponents/AreaStyleDrawer.cs @@ -18,6 +18,7 @@ namespace XCharts.Editor PropertyField(prop, "m_Color"); PropertyField(prop, "m_ToColor"); PropertyField(prop, "m_Opacity"); + PropertyField(prop, "m_ToTop"); PropertyField(prop, "m_InnerFill"); --EditorGUI.indentLevel; } diff --git a/Editor/ChildComponents/ItemStyleDrawer.cs b/Editor/ChildComponents/ItemStyleDrawer.cs index 50978b07..1f772079 100644 --- a/Editor/ChildComponents/ItemStyleDrawer.cs +++ b/Editor/ChildComponents/ItemStyleDrawer.cs @@ -18,6 +18,7 @@ namespace XCharts.Editor PropertyField(prop, "m_Color0"); PropertyField(prop, "m_ToColor"); PropertyField(prop, "m_ToColor2"); + PropertyField(prop, "m_MarkColor"); PropertyField(prop, "m_BackgroundColor"); PropertyField(prop, "m_BackgroundWidth"); PropertyField(prop, "m_CenterColor"); diff --git a/Editor/ChildComponents/LabelStyleDrawer.cs b/Editor/ChildComponents/LabelStyleDrawer.cs index 103b345b..359da59d 100644 --- a/Editor/ChildComponents/LabelStyleDrawer.cs +++ b/Editor/ChildComponents/LabelStyleDrawer.cs @@ -20,6 +20,7 @@ namespace XCharts.Editor PropertyField(prop, "m_AutoOffset"); PropertyField(prop, "m_Offset"); PropertyField(prop, "m_Distance"); + PropertyField(prop, "m_AutoRotate"); PropertyField(prop, "m_Rotate"); PropertyField(prop, "m_Width"); PropertyField(prop, "m_Height"); diff --git a/Editor/MainComponents/DataZoomEditor.cs b/Editor/MainComponents/DataZoomEditor.cs index fa85d49e..10f0fdba 100644 --- a/Editor/MainComponents/DataZoomEditor.cs +++ b/Editor/MainComponents/DataZoomEditor.cs @@ -29,6 +29,8 @@ namespace XCharts.Editor PropertyField("m_RangeMode"); PropertyField(m_Start); PropertyField(m_End); + PropertyField("m_StartLock"); + PropertyField("m_EndLock"); PropertyField(m_MinShowNum); if (m_Start.floatValue < 0) m_Start.floatValue = 0; if (m_End.floatValue > 100) m_End.floatValue = 100; diff --git a/Editor/MainComponents/LegendEditor.cs b/Editor/MainComponents/LegendEditor.cs index db3d8063..340b567b 100644 --- a/Editor/MainComponents/LegendEditor.cs +++ b/Editor/MainComponents/LegendEditor.cs @@ -24,6 +24,7 @@ namespace XCharts.Editor PropertyField("m_Padding"); PropertyListField("m_Icons"); PropertyListField("m_Colors"); + PropertyListField("m_Positions"); PropertyListField("m_Data"); --EditorGUI.indentLevel; } diff --git a/Editor/MainComponents/MainComponentListEditor.cs b/Editor/MainComponents/MainComponentListEditor.cs index 211cb31b..97ca4c14 100644 --- a/Editor/MainComponents/MainComponentListEditor.cs +++ b/Editor/MainComponents/MainComponentListEditor.cs @@ -151,6 +151,7 @@ namespace XCharts.Editor m_Editors[id].OnDisable(); chart.RemoveChartComponent(m_Editors[id].component); m_Editors.RemoveAt(id); + chart.RebuildChartObject(); m_ComponentsProperty = m_BaseEditor.RefreshComponent(); RefreshEditors(); EditorUtility.SetDirty(chart); diff --git a/Editor/MainComponents/UIComponentEditor.cs b/Editor/MainComponents/UIComponentEditor.cs new file mode 100644 index 00000000..b942a2bd --- /dev/null +++ b/Editor/MainComponents/UIComponentEditor.cs @@ -0,0 +1,121 @@ +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using UnityEngine.Assertions; +using XCharts.Runtime; + +namespace XCharts.Editor +{ + public class UIComponentEditor : UnityEditor.Editor + { + class Styles + { + public static readonly GUIContent btnAddComponent = new GUIContent("Add Main Component", ""); + public static readonly GUIContent btnRebuildChartObject = new GUIContent("Rebuild Object", ""); + public static readonly GUIContent btnSaveAsImage = new GUIContent("Save As Image", ""); + public static readonly GUIContent btnCheckWarning = new GUIContent("Check Warning", ""); + public static readonly GUIContent btnHideWarning = new GUIContent("Hide Warning", ""); + } + public UIComponent m_UIComponent; + + public static T AddUIComponent<T>(string chartName) where T : UIComponent + { + return XChartsEditor.AddGraph<T>(chartName); + } + + protected Dictionary<string, SerializedProperty> m_Properties = new Dictionary<string, SerializedProperty>(); + + protected virtual void OnEnable() + { + m_Properties.Clear(); + m_UIComponent = (UIComponent) target; + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + PropertyField("m_Script"); + + OnStartInspectorGUI(); + OnDebugInspectorGUI(); + serializedObject.ApplyModifiedProperties(); + } + + protected virtual void OnStartInspectorGUI() { } + + protected virtual void OnDebugInspectorGUI() + { + EditorGUILayout.Space(); + PropertyField("m_DebugModel"); + OnDebugStartInspectorGUI(); + if (GUILayout.Button(Styles.btnRebuildChartObject)) + { + m_UIComponent.RebuildChartObject(); + } + if (GUILayout.Button(Styles.btnSaveAsImage)) + { + m_UIComponent.SaveAsImage(); + } + OnDebugEndInspectorGUI(); + } + + protected virtual void OnDebugStartInspectorGUI() { } + protected virtual void OnDebugEndInspectorGUI() { } + + protected void PropertyField(string name) + { + if (!m_Properties.ContainsKey(name)) + { + var prop = serializedObject.FindProperty(name); + if (prop == null) + { + Debug.LogError("Property " + name + " not found!"); + return; + } + m_Properties.Add(name, prop); + } + EditorGUILayout.PropertyField(m_Properties[name]); + } + + protected void PropertyField(SerializedProperty property) + { + Assert.IsNotNull(property); + var title = ChartEditorHelper.GetContent(property.displayName); + PropertyField(property, title); + } + + protected void PropertyField(SerializedProperty property, GUIContent title) + { + EditorGUILayout.PropertyField(property, title); + } + + protected void PropertyListField(string relativePropName, bool showOrder = true, params HeaderMenuInfo[] menus) + { + var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f); + var height = 0f; + var prop = FindProperty(relativePropName); + prop.isExpanded = ChartEditorHelper.MakeListWithFoldout(ref m_DrawRect, ref height, + prop, prop.isExpanded, showOrder, true, menus); + if (prop.isExpanded) + { + GUILayoutUtility.GetRect(1f, height - 17); + } + } + + protected void PropertyTwoFiled(string relativePropName) + { + var m_DrawRect = GUILayoutUtility.GetRect(1f, 17f); + var prop = FindProperty(relativePropName); + ChartEditorHelper.MakeTwoField(ref m_DrawRect, m_DrawRect.width, prop, prop.displayName); + } + + protected SerializedProperty FindProperty(string path) + { + if (!m_Properties.ContainsKey(path)) + { + m_Properties.Add(path, serializedObject.FindProperty(path)); + } + return m_Properties[path]; + } + } +} \ No newline at end of file diff --git a/Runtime/Widgets/ProgressBar.cs.meta b/Editor/MainComponents/UIComponentEditor.cs.meta similarity index 83% rename from Runtime/Widgets/ProgressBar.cs.meta rename to Editor/MainComponents/UIComponentEditor.cs.meta index 1b34a707..72da37b3 100644 --- a/Runtime/Widgets/ProgressBar.cs.meta +++ b/Editor/MainComponents/UIComponentEditor.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cd18af5634e604a3c97fb1ff0fc5d682 +guid: d226759112b0d463b8fba4830762893c MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Editor/MainComponents/UIComponentThemeDrawer.cs b/Editor/MainComponents/UIComponentThemeDrawer.cs new file mode 100644 index 00000000..d06d6140 --- /dev/null +++ b/Editor/MainComponents/UIComponentThemeDrawer.cs @@ -0,0 +1,23 @@ +using UnityEditor; +using UnityEngine; +using XCharts.Runtime; + +namespace XCharts.Editor +{ + [CustomPropertyDrawer(typeof(UIComponentTheme), true)] + public class UIComponentThemeDrawer : BasePropertyDrawer + { + public override string ClassName { get { return "Theme"; } } + public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) + { + base.OnGUI(pos, prop, label); + if (MakeComponentFoldout(prop, "m_Show", true)) + { + ++EditorGUI.indentLevel; + PropertyField(prop, "m_SharedTheme"); + PropertyField(prop, "m_TransparentBackground"); + --EditorGUI.indentLevel; + } + } + } +} \ No newline at end of file diff --git a/Editor/Widgets/ProgressBarEditor.cs.meta b/Editor/MainComponents/UIComponentThemeDrawer.cs.meta similarity index 83% rename from Editor/Widgets/ProgressBarEditor.cs.meta rename to Editor/MainComponents/UIComponentThemeDrawer.cs.meta index 37bbd287..75ad5abd 100644 --- a/Editor/Widgets/ProgressBarEditor.cs.meta +++ b/Editor/MainComponents/UIComponentThemeDrawer.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 17cd5e3604edc43e5b7b6bfc3c71857b +guid: dca2d7a2ed994420182384c2efa48c0c MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Editor/Series/BarEditor.cs b/Editor/Series/BarEditor.cs index 55a1af79..b2521820 100644 --- a/Editor/Series/BarEditor.cs +++ b/Editor/Series/BarEditor.cs @@ -48,7 +48,6 @@ namespace XCharts.Editor PropertyField("m_Large"); PropertyField("m_LargeThreshold"); PropertyField("m_PlaceHolder"); - PropertyField("m_MarkColor"); }); PropertyField("m_ItemStyle"); PropertyField("m_Animation"); diff --git a/Editor/Series/LineEditor.cs b/Editor/Series/LineEditor.cs index 91f6fe62..95b2e67c 100644 --- a/Editor/Series/LineEditor.cs +++ b/Editor/Series/LineEditor.cs @@ -37,7 +37,6 @@ namespace XCharts.Editor PropertyField("m_ShowAsPositiveNumber"); PropertyField("m_Large"); PropertyField("m_LargeThreshold"); - PropertyField("m_MarkColor"); }); PropertyField("m_Symbol"); PropertyField("m_LineStyle"); diff --git a/Editor/Series/PieEditor.cs b/Editor/Series/PieEditor.cs index 7a66372f..f8e19be5 100644 --- a/Editor/Series/PieEditor.cs +++ b/Editor/Series/PieEditor.cs @@ -18,6 +18,7 @@ namespace XCharts.Editor PropertyField("m_RoundCap"); PropertyField("m_Ignore"); PropertyField("m_IgnoreValue"); + PropertyField("m_ClickOffset"); }); PropertyField("m_ItemStyle"); PropertyField("m_Animation"); diff --git a/Editor/Series/SerieEditor.cs b/Editor/Series/SerieEditor.cs index 82cfa37d..e251d810 100644 --- a/Editor/Series/SerieEditor.cs +++ b/Editor/Series/SerieEditor.cs @@ -204,15 +204,15 @@ namespace XCharts.Editor } serieDataMenus.Clear(); - if (serie.GetType().IsDefined(typeof(SerieDataExtraComponentAttribute), false)) + if (serie.GetType().IsDefined(typeof(SerieDataComponentAttribute), false)) { - var attribute = serie.GetType().GetAttribute<SerieDataExtraComponentAttribute>(); + var attribute = serie.GetType().GetAttribute<SerieDataComponentAttribute>(); foreach (var type in attribute.types) { var size = serieData.FindPropertyRelative(SerieData.extraComponentMap[type]).arraySize; serieDataMenus.Add(new HeaderMenuInfo("Add " + type.Name, () => { - serie.GetSerieData(index).GetOrAddComponent(type); + serie.GetSerieData(index).EnsureComponent(type); EditorUtility.SetDirty(chart); }, size == 0)); } diff --git a/Editor/Series/SerieListEditor.cs b/Editor/Series/SerieListEditor.cs index 02e39e86..406845b0 100644 --- a/Editor/Series/SerieListEditor.cs +++ b/Editor/Series/SerieListEditor.cs @@ -169,22 +169,22 @@ namespace XCharts.Editor RefreshEditors(); } })); - foreach (var type in GetCovertToSerie(editor.serie.GetType())) + foreach (var type in GetConvertToSerie(editor.serie.GetType())) { - editor.menus.Add(new HeaderMenuInfo("Covert to " + type.Name, () => + editor.menus.Add(new HeaderMenuInfo("Convert to " + type.Name, () => { - CovertSerie(editor.serie, type); + ConvertSerie(editor.serie, type); })); } - if (editor.serie.GetType().IsDefined(typeof(SerieExtraComponentAttribute), false)) + if (editor.serie.GetType().IsDefined(typeof(SerieComponentAttribute), false)) { - var attribute = editor.serie.GetType().GetAttribute<SerieExtraComponentAttribute>(); + var attribute = editor.serie.GetType().GetAttribute<SerieComponentAttribute>(); foreach (var type in attribute.types) { var size = editor.FindProperty(Serie.extraComponentMap[type]).arraySize; editor.menus.Add(new HeaderMenuInfo("Add " + type.Name, () => { - editor.serie.AddExtraComponent(type); + editor.serie.EnsureComponent(type); RefreshEditors(); chart.RefreshAllComponent(); EditorUtility.SetDirty(chart); @@ -195,7 +195,7 @@ namespace XCharts.Editor var size = editor.FindProperty(Serie.extraComponentMap[type]).arraySize; editor.menus.Add(new HeaderMenuInfo("Remove " + type.Name, () => { - editor.serie.RemoveExtraComponent(type); + editor.serie.RemoveComponent(type); RefreshEditors(); chart.RefreshAllComponent(); EditorUtility.SetDirty(chart); @@ -224,9 +224,9 @@ namespace XCharts.Editor AssetDatabase.Refresh(); } - public void CovertSerie(Serie serie, Type type) + public void ConvertSerie(Serie serie, Type type) { - chart.CovertSerie(serie, type); + chart.ConvertSerie(serie, type); m_SeriesProperty = m_BaseEditor.RefreshSeries(); RefreshEditors(); } @@ -254,7 +254,7 @@ namespace XCharts.Editor AssetDatabase.Refresh(); } - private List<Type> GetCovertToSerie(Type serie) + private List<Type> GetConvertToSerie(Type serie) { var list = new List<Type>(); var typeMap = RuntimeUtil.GetAllTypesDerivedFrom<Serie>(); diff --git a/Editor/Utilities/ChartEditorHelper.cs b/Editor/Utilities/ChartEditorHelper.cs index 647e7166..0c0aeb64 100644 --- a/Editor/Utilities/ChartEditorHelper.cs +++ b/Editor/Utilities/ChartEditorHelper.cs @@ -318,8 +318,8 @@ namespace XCharts.Editor { EditorGUI.indentLevel++; var listSize = listProp.arraySize; - var iconWidth = 14; - var iconGap = 3f; + var iconWidth = 10; + var iconGap = 0f; if (showSize) { @@ -383,20 +383,25 @@ namespace XCharts.Editor var isSerie = "Serie".Equals(element.type); var elementRect = isSerie ? new Rect(drawRect.x, drawRect.y, drawRect.width + INDENT_WIDTH - 2 * iconGap, drawRect.height) : - new Rect(drawRect.x, drawRect.y, drawRect.width - 3 * iconWidth, drawRect.height); + new Rect(drawRect.x, drawRect.y, drawRect.width - 4 * iconWidth, drawRect.height); EditorGUI.PropertyField(elementRect, element, new GUIContent("Element " + i)); - var iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height); + var iconRect = new Rect(drawRect.width - 4 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height); var oldColor = GUI.contentColor; GUI.contentColor = Color.black; if (GUI.Button(iconRect, EditorCustomStyles.iconUp, EditorCustomStyles.invisibleButton)) { if (i > 0) listProp.MoveArrayElement(i, i - 1); } - iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height); + iconRect = new Rect(drawRect.width - 3 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height); if (GUI.Button(iconRect, EditorCustomStyles.iconDown, EditorCustomStyles.invisibleButton)) { if (i < listProp.arraySize - 1) listProp.MoveArrayElement(i, i + 1); } + iconRect = new Rect(drawRect.width - 2 * iconWidth + temp, drawRect.y, iconWidth, drawRect.height); + if (GUI.Button(iconRect, EditorCustomStyles.iconAdd, EditorCustomStyles.invisibleButton)) + { + if (i < listProp.arraySize && i >= 0) listProp.InsertArrayElementAtIndex(i); + } iconRect = new Rect(drawRect.width - iconWidth + temp, drawRect.y, iconWidth, drawRect.height); if (GUI.Button(iconRect, EditorCustomStyles.iconRemove, EditorCustomStyles.invisibleButton)) { @@ -539,7 +544,7 @@ namespace XCharts.Editor return HEADER_HEIGHT; } - internal static bool DrawHeader(string title, bool state, bool drawBackground, SerializedProperty activeField, + public static bool DrawHeader(string title, bool state, bool drawBackground, SerializedProperty activeField, Action<Rect> drawCallback, params HeaderMenuInfo[] menus) { var rect = GUILayoutUtility.GetRect(1f, HEADER_HEIGHT); diff --git a/Editor/Widgets.meta b/Editor/Widgets.meta deleted file mode 100644 index cd483900..00000000 --- a/Editor/Widgets.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b92d575a960f54e9a9417cca092d1e11 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Editor/Widgets/ProgressBarEditor.cs b/Editor/Widgets/ProgressBarEditor.cs deleted file mode 100644 index 112269b4..00000000 --- a/Editor/Widgets/ProgressBarEditor.cs +++ /dev/null @@ -1,51 +0,0 @@ -using UnityEditor; -using XCharts.Runtime; - -namespace XCharts.Editor -{ - [CustomEditor(typeof(ProgressBar), false)] - public class ProgressBarEditor : UnityEditor.Editor - { - - [MenuItem("XCharts/ProgressBar", priority = 200)] - [MenuItem("GameObject/XCharts/ProgressBar", priority = 200)] - public static void AddPyramidChart() - { - XChartsEditor.AddChart<ProgressBar>("ProgressBar"); - } - - protected SerializedProperty m_Script; - protected SerializedProperty m_Value; - protected SerializedProperty m_BackgroundColor; - protected SerializedProperty m_StartColor; - protected SerializedProperty m_EndColor; - protected SerializedProperty m_CornerRadius; - - protected virtual void OnEnable() - { - m_Script = serializedObject.FindProperty("m_Script"); - m_Value = serializedObject.FindProperty("m_Value"); - m_BackgroundColor = serializedObject.FindProperty("m_BackgroundColor"); - m_StartColor = serializedObject.FindProperty("m_StartColor"); - m_EndColor = serializedObject.FindProperty("m_EndColor"); - m_CornerRadius = serializedObject.FindProperty("m_CornerRadius"); - } - - public override void OnInspectorGUI() - { - serializedObject.Update(); - OnStartInspectorGUI(); - serializedObject.ApplyModifiedProperties(); - } - - protected virtual void OnStartInspectorGUI() - { - EditorGUILayout.PropertyField(m_Script); - EditorGUILayout.PropertyField(m_BackgroundColor); - EditorGUILayout.PropertyField(m_StartColor); - EditorGUILayout.PropertyField(m_EndColor); - EditorGUILayout.PropertyField(m_Value); - EditorGUILayout.PropertyField(m_CornerRadius); - } - } -} \ No newline at end of file diff --git a/Editor/Windows/XChartsEditor.cs b/Editor/Windows/XChartsEditor.cs index ed33ec98..99ed4adc 100644 --- a/Editor/Windows/XChartsEditor.cs +++ b/Editor/Windows/XChartsEditor.cs @@ -1,8 +1,14 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using UnityEditor; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using XCharts.Runtime; +using ADB = UnityEditor.AssetDatabase; + namespace XCharts.Editor { @@ -22,7 +28,7 @@ namespace XCharts.Editor canvas = canvasObject.AddComponent<Canvas>(); canvas.renderMode = RenderMode.ScreenSpaceCamera; var mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); - canvas.worldCamera = mainCamera == null? null : mainCamera.GetComponent<Camera>(); + canvas.worldCamera = mainCamera == null ? null : mainCamera.GetComponent<Camera>(); canvasObject.AddComponent<CanvasScaler>(); canvasObject.AddComponent<GraphicRaycaster>(); if (GameObject.Find("EventSystem") == null) @@ -56,24 +62,30 @@ namespace XCharts.Editor } public static T AddChart<T>(string chartName) where T : BaseChart + { + XCThemeMgr.CheckReloadTheme(); + return AddGraph<T>(chartName); + } + + public static T AddGraph<T>(string graphName) where T : BaseGraph { var parent = GetParent(); if (parent == null) return null; XCThemeMgr.CheckReloadTheme(); - var chart = new GameObject(); - chart.name = GetName(parent, chartName); - chart.layer = LayerMask.NameToLayer("UI"); - var t = chart.AddComponent<T>(); - chart.transform.SetParent(parent); - chart.transform.localScale = Vector3.one; - chart.transform.localPosition = Vector3.zero; - chart.transform.localRotation = Quaternion.Euler(0, 0, 0); - var rect = chart.GetComponent<RectTransform>(); + var obj = new GameObject(); + obj.name = GetName(parent, graphName); + obj.layer = LayerMask.NameToLayer("UI"); + var t = obj.AddComponent<T>(); + obj.transform.SetParent(parent); + obj.transform.localScale = Vector3.one; + obj.transform.localPosition = Vector3.zero; + obj.transform.localRotation = Quaternion.Euler(0, 0, 0); + var rect = obj.GetComponent<RectTransform>(); rect.anchorMin = new Vector2(0.5f, 0.5f); rect.anchorMax = new Vector2(0.5f, 0.5f); rect.pivot = new Vector2(0.5f, 0.5f); - Selection.activeGameObject = chart; - EditorUtility.SetDirty(chart); + Selection.activeGameObject = obj; + EditorUtility.SetDirty(obj); return t; } @@ -182,23 +194,155 @@ namespace XCharts.Editor XCThemeMgr.ReloadThemeList(); } + #region Text mesh pro support +#if UNITY_2017_1_OR_NEWER + const string SYMBOL_TMP = "dUI_TextMeshPro"; + const string ASMDEF_TMP = "Unity.TextMeshPro"; + [MenuItem("XCharts/TextMeshPro Enable")] public static void EnableTextMeshPro() { - if (!XChartsMgr.IsExistTMPAssembly()) + if (!IsSpecifyAssemblyExist(ASMDEF_TMP)) { Debug.LogError("TextMeshPro is not in the project, please import TextMeshPro package first."); return; } - XChartsMgr.EnableTextMeshPro(); - XChartsMgr.ModifyTMPRefence(); + DefineSymbolsUtil.AddGlobalDefine(SYMBOL_TMP); + XChartsMgr.RemoveAllChartObject(); + InsertSpecifyReferenceIntoAssembly(Platform.Editor, ASMDEF_TMP); + InsertSpecifyReferenceIntoAssembly(Platform.Runtime, ASMDEF_TMP); } [MenuItem("XCharts/TextMeshPro Disable")] public static void DisableTextMeshPro() { - XChartsMgr.ModifyTMPRefence(true); - XChartsMgr.DisableTextMeshPro(); + RemoveSpecifyReferenceFromAssembly(Platform.Editor, ASMDEF_TMP); + RemoveSpecifyReferenceFromAssembly(Platform.Runtime, ASMDEF_TMP); + DefineSymbolsUtil.RemoveGlobalDefine(SYMBOL_TMP); + XChartsMgr.RemoveAllChartObject(); } +#endif + #endregion + + #region InputSystem Support +#if UNITY_2019_1_OR_NEWER + //As InputSystem is released in 2019.1+ ,when unity version is 2019.1+ , enable InputSystem Support + const string SYMBOL_I_S = "INPUT_SYSTEM_ENABLED"; + const string ASMDEF_I_S = "Unity.InputSystem"; + [MenuItem("XCharts/InputSystem Enable")] + public static void EnableInputSystem() + { + if (!IsSpecifyAssemblyExist(ASMDEF_I_S)) + { + Debug.LogError("InputSystem is not in the project, please import InputSystem package first."); + return; + } + // insert input system package into editor and runtime assembly + InsertSpecifyReferenceIntoAssembly(Platform.Editor, ASMDEF_I_S); + InsertSpecifyReferenceIntoAssembly(Platform.Runtime, ASMDEF_I_S); + // add scripting define symbols + DefineSymbolsUtil.AddGlobalDefine(SYMBOL_I_S); + } + [MenuItem("XCharts/InputSystem Disable")] + public static void DisableInputSystem() + { + // remove input system package into editor and runtime assembly + RemoveSpecifyReferenceFromAssembly(Platform.Editor, ASMDEF_I_S); + RemoveSpecifyReferenceFromAssembly(Platform.Runtime, ASMDEF_I_S); + // remove scripting define symbols + DefineSymbolsUtil.RemoveGlobalDefine(SYMBOL_I_S); + } +#endif + #endregion + + #region Assistant members +#if UNITY_2017_1_OR_NEWER + // as text mesh pro is released in 2017.1, so we may use these function and types in 2017.1 or later + private static void InsertSpecifyReferenceIntoAssembly(Platform platform, string reference) + { + var file = GetPackageAssemblyDefinitionPath(platform); + var content = File.ReadAllText(file); + var data = new AssemblyDefinitionData(); + EditorJsonUtility.FromJsonOverwrite(content, data); + if (!data.references.Contains(reference)) + { + data.references.Add(reference); + var json = EditorJsonUtility.ToJson(data, true); + File.WriteAllText(file, json); + AssetDatabase.SaveAssets(); + AssetDatabase.Refresh(); + } + } + + private static void RemoveSpecifyReferenceFromAssembly(Platform platform, string reference) + { + var file = GetPackageAssemblyDefinitionPath(platform); + var content = File.ReadAllText(file); + var data = new AssemblyDefinitionData(); + EditorJsonUtility.FromJsonOverwrite(content, data); + if (data.references.Contains(reference)) + { + data.references.Remove(reference); + var json = EditorJsonUtility.ToJson(data, true); + File.WriteAllText(file, json); + } + } + + public enum Platform { Editor, Runtime } + public static string GetPackageAssemblyDefinitionPath(Platform platform) + { + var p = platform == Platform.Editor ? "Editor" : "Runtime"; + var f = "XCharts." + p + ".asmdef"; + var sub = Path.Combine(p, f); + string packagePath = Path.GetFullPath("Packages/com.monitor1394.xcharts"); + if (!Directory.Exists(packagePath)) + { + packagePath = ADB.FindAssets("t:Script") + .Where(v => Path.GetFileNameWithoutExtension(ADB.GUIDToAssetPath(v)) == "XChartsMgr") + .Select(id => ADB.GUIDToAssetPath(id)) + .FirstOrDefault(); + packagePath = Path.GetDirectoryName(packagePath); + packagePath = packagePath.Substring(0, packagePath.LastIndexOf("Runtime")); + } + return Path.Combine(packagePath, sub); + } + + public static bool IsSpecifyAssemblyExist(string name) + { +#if UNITY_2018_1_OR_NEWER + foreach (var assembly in UnityEditor.Compilation.CompilationPipeline.GetAssemblies(UnityEditor.Compilation.AssembliesType.Player)) + { + if (assembly.name.Equals(name)) return true; + } +#elif UNITY_2017_3_OR_NEWER + foreach (var assembly in UnityEditor.Compilation.CompilationPipeline.GetAssemblies()) + { + if (assembly.name.Equals(name)) return true; + } +#endif + return false; + } + + [Serializable] + class AssemblyDefinitionData + { +#pragma warning disable 649 + public string name; + public List<string> references; + public List<string> includePlatforms; + public List<string> excludePlatforms; + public bool allowUnsafeCode; + public bool overrideReferences; + public List<string> precompiledReferences; + public bool autoReferenced; + public List<string> defineConstraints; + public List<string> versionDefines; + public bool noEngineReferences; +#pragma warning restore 649 + } +#endif + #endregion + + } } \ No newline at end of file diff --git a/Examples/Example00_CheatSheet.cs b/Examples/Example00_CheatSheet.cs index 99bce3df..0b22b89b 100644 --- a/Examples/Example00_CheatSheet.cs +++ b/Examples/Example00_CheatSheet.cs @@ -11,42 +11,33 @@ namespace XCharts.Example private LineChart chart; private float speed = 100f; - void Awake() - { - LoopDemo(); - } - private void OnEnable() { - LoopDemo(); - } - - void LoopDemo() - { - StopAllCoroutines(); StartCoroutine(CheatSheet()); } IEnumerator CheatSheet() { StartCoroutine(InitChart()); - StartCoroutine(ComponentTitle()); - yield return new WaitForSeconds(2); - StartCoroutine(ComponentAxis()); - yield return new WaitForSeconds(2); - StartCoroutine(ComponentGrid()); - yield return new WaitForSeconds(2); - StartCoroutine(ComponentSerie()); - yield return new WaitForSeconds(4); - StartCoroutine(ComponentLegend()); - yield return new WaitForSeconds(4); - StartCoroutine(ComponentTheme()); - yield return new WaitForSeconds(4); - StartCoroutine(ComponentDataZoom()); - yield return new WaitForSeconds(5); - StartCoroutine(ComponentVisualMap()); - yield return new WaitForSeconds(3); - LoopDemo(); + while (true) + { + StartCoroutine(ComponentTitle()); + yield return new WaitForSeconds(2); + StartCoroutine(ComponentAxis()); + yield return new WaitForSeconds(2); + StartCoroutine(ComponentGrid()); + yield return new WaitForSeconds(2); + StartCoroutine(ComponentSerie()); + yield return new WaitForSeconds(4); + StartCoroutine(ComponentLegend()); + yield return new WaitForSeconds(4); + StartCoroutine(ComponentTheme()); + yield return new WaitForSeconds(4); + StartCoroutine(ComponentDataZoom()); + yield return new WaitForSeconds(5); + StartCoroutine(ComponentVisualMap()); + yield return new WaitForSeconds(3); + } } IEnumerator InitChart() @@ -54,10 +45,10 @@ namespace XCharts.Example chart = gameObject.GetComponent<LineChart>(); if (chart == null) gameObject.AddComponent<LineChart>(); - chart.GetChartComponent<Title>().show = true; - chart.GetChartComponent<Title>().text = "术语解析-组件"; + chart.EnsureChartComponent<Title>().show = true; + chart.EnsureChartComponent<Title>().text = "术语解析-组件"; - var grid = chart.GetOrAddChartComponent<GridCoord>(); + var grid = chart.EnsureChartComponent<GridCoord>(); grid.bottom = 30; grid.right = 30; grid.left = 50; @@ -81,31 +72,31 @@ namespace XCharts.Example IEnumerator ComponentTitle() { - chart.GetChartComponent<Title>().text = "术语解析 - 组件"; - chart.GetChartComponent<Title>().subText = "Title 标题:可指定主标题和子标题"; - chart.GetChartComponent<XAxis>().show = true; - chart.GetChartComponent<YAxis>().show = true; - chart.GetChartComponent<Legend>().show = false; + chart.EnsureChartComponent<Title>().text = "术语解析 - 组件"; + chart.EnsureChartComponent<Title>().subText = "Title 标题:可指定主标题和子标题"; + chart.EnsureChartComponent<XAxis>().show = true; + chart.EnsureChartComponent<YAxis>().show = true; + chart.EnsureChartComponent<Legend>().show = false; chart.series[0].show = false; chart.series[1].show = false; for (int i = 0; i < 4; i++) { - chart.GetChartComponent<Title>().show = !chart.GetChartComponent<Title>().show; + chart.EnsureChartComponent<Title>().show = !chart.EnsureChartComponent<Title>().show; chart.RefreshChart(); yield return new WaitForSeconds(0.2f); } - chart.GetChartComponent<Title>().show = true; + chart.EnsureChartComponent<Title>().show = true; chart.RefreshChart(); } IEnumerator ComponentAxis() { - chart.GetChartComponent<Title>().subText = "Axis 坐标轴:配置X和Y轴的轴线、刻度、标签等样式外观配置"; + chart.EnsureChartComponent<Title>().subText = "Axis 坐标轴:配置X和Y轴的轴线、刻度、标签等样式外观配置"; chart.series[0].show = false; chart.series[1].show = false; - var xAxis = chart.GetChartComponent<XAxis>(); - var yAxis = chart.GetChartComponent<YAxis>(); + var xAxis = chart.EnsureChartComponent<XAxis>(); + var yAxis = chart.EnsureChartComponent<YAxis>(); for (int i = 0; i < 4; i++) { xAxis.show = !xAxis.show; @@ -121,8 +112,8 @@ namespace XCharts.Example IEnumerator ComponentGrid() { - chart.GetChartComponent<Title>().subText = "Grid 网格:调整坐标系边距和颜色等"; - var grid = chart.GetChartComponent<GridCoord>(); + chart.EnsureChartComponent<Title>().subText = "Grid 网格:调整坐标系边距和颜色等"; + var grid = chart.EnsureChartComponent<GridCoord>(); for (int i = 0; i < 4; i++) { grid.backgroundColor = i % 2 == 0 ? Color.clear : Color.grey; @@ -136,7 +127,7 @@ namespace XCharts.Example IEnumerator ComponentSerie() { - chart.GetChartComponent<Title>().subText = "Serie 系列:调整坐标系边距和颜色等"; + chart.EnsureChartComponent<Title>().subText = "Serie 系列:调整坐标系边距和颜色等"; chart.series[0].show = true; chart.series[1].show = true; chart.AnimationReset(); @@ -157,10 +148,10 @@ namespace XCharts.Example IEnumerator ComponentLegend() { - chart.GetChartComponent<Title>().subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等"; - var legend = chart.GetChartComponent<Legend>(); + chart.EnsureChartComponent<Title>().subText = "Legend 图例:展示不同系列的名字和颜色,可控制系列显示等"; + var legend = chart.EnsureChartComponent<Legend>(); legend.show = true; - var grid = chart.GetChartComponent<GridCoord>(); + var grid = chart.EnsureChartComponent<GridCoord>(); grid.top = 80; legend.location.top = 50; chart.RefreshChart(); @@ -187,26 +178,26 @@ namespace XCharts.Example IEnumerator ComponentTheme() { - chart.GetChartComponent<Title>().subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换"; + chart.EnsureChartComponent<Title>().subText = "Theme 主题:可从全局上配置图表的颜色、字体等效果,支持默认主题切换"; yield return new WaitForSeconds(1f); - chart.GetChartComponent<Title>().subText = "Theme 主题:Light主题"; + chart.EnsureChartComponent<Title>().subText = "Theme 主题:Light主题"; chart.UpdateTheme(ThemeType.Light); yield return new WaitForSeconds(1f); - chart.GetChartComponent<Title>().subText = "Theme 主题:Dark主题"; + chart.EnsureChartComponent<Title>().subText = "Theme 主题:Dark主题"; chart.UpdateTheme(ThemeType.Dark); yield return new WaitForSeconds(1f); - chart.GetChartComponent<Title>().subText = "Theme 主题:Default主题"; + chart.EnsureChartComponent<Title>().subText = "Theme 主题:Default主题"; chart.UpdateTheme(ThemeType.Default); yield return new WaitForSeconds(1f); } IEnumerator ComponentDataZoom() { - chart.GetChartComponent<Title>().subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据"; - var grid = chart.GetChartComponent<GridCoord>(); + chart.EnsureChartComponent<Title>().subText = "DataZoom 区域缩放:可通过拖、拽、缩小、放大来观察细节数据"; + var grid = chart.EnsureChartComponent<GridCoord>(); grid.bottom = 70; - var dataZoom = chart.GetOrAddChartComponent<DataZoom>(); + var dataZoom = chart.EnsureChartComponent<DataZoom>(); dataZoom.enable = true; dataZoom.supportInside = true; dataZoom.supportSlider = true; @@ -265,9 +256,9 @@ namespace XCharts.Example IEnumerator ComponentVisualMap() { - chart.GetChartComponent<Title>().subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换"; + chart.EnsureChartComponent<Title>().subText = "VisualMap 视觉映射:可从全局上配置图表的颜色、字体等效果,支持默认主题切换"; - var visualMap = chart.GetOrAddChartComponent<VisualMap>(); + var visualMap = chart.EnsureChartComponent<VisualMap>(); visualMap.show = true; visualMap.showUI = true; visualMap.orient = Orient.Vertical; @@ -292,7 +283,7 @@ namespace XCharts.Example "#a50026" }; visualMap.AddColors(colors); - var grid = chart.GetChartComponent<GridCoord>(); + var grid = chart.EnsureChartComponent<GridCoord>(); grid.left = 80; grid.bottom = 100; chart.RefreshChart(); diff --git a/Examples/Example04_DataZoom.cs b/Examples/Example04_DataZoom.cs index 8f18c272..b555b299 100644 --- a/Examples/Example04_DataZoom.cs +++ b/Examples/Example04_DataZoom.cs @@ -38,11 +38,11 @@ namespace XCharts.Example { if (dataZoom.IsInMarqueeArea(serieData)) { - serieData.GetOrAddComponent<ItemStyle>().color = Color.red; + serieData.EnsureComponent<ItemStyle>().color = Color.red; } else { - serieData.GetOrAddComponent<ItemStyle>().color = Color.clear; + serieData.EnsureComponent<ItemStyle>().color = Color.clear; } } } diff --git a/Examples/Example10_LineChart.cs b/Examples/Example10_LineChart.cs index 1067b991..2dabb5fb 100644 --- a/Examples/Example10_LineChart.cs +++ b/Examples/Example10_LineChart.cs @@ -11,39 +11,30 @@ namespace XCharts.Example private Serie serie; private int m_DataNum = 8; - void Awake() - { - LoopDemo(); - } - private void OnEnable() { - LoopDemo(); - } - - void LoopDemo() - { - StopAllCoroutines(); StartCoroutine(PieDemo()); } IEnumerator PieDemo() { - StartCoroutine(AddSimpleLine()); - yield return new WaitForSeconds(2); - StartCoroutine(ChangeLineType()); - yield return new WaitForSeconds(8); - StartCoroutine(LineAreaStyleSettings()); - yield return new WaitForSeconds(5); - StartCoroutine(LineArrowSettings()); - yield return new WaitForSeconds(2); - StartCoroutine(LineSymbolSettings()); - yield return new WaitForSeconds(7); - StartCoroutine(LineLabelSettings()); - yield return new WaitForSeconds(3); - StartCoroutine(LineMutilSerie()); - yield return new WaitForSeconds(5); - LoopDemo(); + while (true) + { + StartCoroutine(AddSimpleLine()); + yield return new WaitForSeconds(2); + StartCoroutine(ChangeLineType()); + yield return new WaitForSeconds(8); + StartCoroutine(LineAreaStyleSettings()); + yield return new WaitForSeconds(5); + StartCoroutine(LineArrowSettings()); + yield return new WaitForSeconds(2); + StartCoroutine(LineSymbolSettings()); + yield return new WaitForSeconds(7); + StartCoroutine(LineLabelSettings()); + yield return new WaitForSeconds(3); + StartCoroutine(LineMutilSerie()); + yield return new WaitForSeconds(5); + } } IEnumerator AddSimpleLine() @@ -116,7 +107,7 @@ namespace XCharts.Example { chart.GetChartComponent<Title>().subText = "AreaStyle 面积图"; - serie.AddExtraComponent<AreaStyle>(); + serie.EnsureComponent<AreaStyle>(); serie.areaStyle.show = true; chart.RefreshChart(); yield return new WaitForSeconds(1f); @@ -145,7 +136,7 @@ namespace XCharts.Example IEnumerator LineArrowSettings() { chart.GetChartComponent<Title>().subText = "LineArrow 头部箭头"; - chart.GetSerie(0).AddExtraComponent<LineArrow>(); + chart.GetSerie(0).EnsureComponent<LineArrow>(); serie.lineArrow.show = true; serie.lineArrow.position = LineArrow.Position.Start; chart.RefreshChart(); @@ -207,7 +198,7 @@ namespace XCharts.Example IEnumerator LineLabelSettings() { chart.GetChartComponent<Title>().subText = "SerieLabel 文本标签"; - serie.AddExtraComponent<LabelStyle>(); + serie.EnsureComponent<LabelStyle>(); chart.RefreshChart(); while (serie.label.offset[1] < 20) { diff --git a/Examples/Example11_AddSinCurve.cs b/Examples/Example11_AddSinCurve.cs index 31491178..e54efba0 100644 --- a/Examples/Example11_AddSinCurve.cs +++ b/Examples/Example11_AddSinCurve.cs @@ -4,7 +4,6 @@ using XCharts.Runtime; namespace XCharts.Example { [DisallowMultipleComponent] - [ExecuteInEditMode] public class Example11_AddSinCurve : MonoBehaviour { private float time; @@ -18,14 +17,14 @@ namespace XCharts.Example { chart = gameObject.AddComponent<LineChart>(); } - chart.GetChartComponent<Title>().show = true; - chart.GetChartComponent<Title>().text = "Sin Curve"; + chart.EnsureChartComponent<Title>().show = true; + chart.EnsureChartComponent<Title>().text = "Sin Curve"; - chart.GetChartComponent<Tooltip>().show = true; - chart.GetChartComponent<Legend>().show = false; + chart.EnsureChartComponent<Tooltip>().show = true; + chart.EnsureChartComponent<Legend>().show = false; - var xAxis = chart.GetChartComponent<XAxis>(); - var yAxis = chart.GetChartComponent<YAxis>(); + var xAxis = chart.EnsureChartComponent<XAxis>(); + var yAxis = chart.EnsureChartComponent<YAxis>(); xAxis.show = true; yAxis.show = true; diff --git a/Examples/Example13_LineSimple.cs b/Examples/Example13_LineSimple.cs index 153ef575..72d8ebe4 100644 --- a/Examples/Example13_LineSimple.cs +++ b/Examples/Example13_LineSimple.cs @@ -1,4 +1,7 @@ using UnityEngine; +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif using XCharts.Runtime; namespace XCharts.Example @@ -29,14 +32,14 @@ namespace XCharts.Example chart.Init(); chart.SetSize(580, 300); } - chart.GetOrAddChartComponent<Title>().show = true; - chart.GetOrAddChartComponent<Title>().text = "Line Simple"; + chart.EnsureChartComponent<Title>().show = true; + chart.EnsureChartComponent<Title>().text = "Line Simple"; - chart.GetOrAddChartComponent<Tooltip>().show = true; - chart.GetOrAddChartComponent<Legend>().show = false; + chart.EnsureChartComponent<Tooltip>().show = true; + chart.EnsureChartComponent<Legend>().show = false; - var xAxis = chart.GetOrAddChartComponent<XAxis>(); - var yAxis = chart.GetOrAddChartComponent<YAxis>(); + var xAxis = chart.EnsureChartComponent<XAxis>(); + var yAxis = chart.EnsureChartComponent<YAxis>(); xAxis.show = true; yAxis.show = true; xAxis.type = Axis.AxisType.Category; diff --git a/Examples/Example20_BarChart.cs b/Examples/Example20_BarChart.cs index 270321ac..70149d6a 100644 --- a/Examples/Example20_BarChart.cs +++ b/Examples/Example20_BarChart.cs @@ -11,48 +11,38 @@ namespace XCharts.Example private Serie serie, serie2; private int m_DataNum = 5; - void Awake() - { - LoopDemo(); - } - private void OnEnable() { - LoopDemo(); - } - - void LoopDemo() - { - StopAllCoroutines(); StartCoroutine(PieDemo()); } IEnumerator PieDemo() { - StartCoroutine(AddSimpleBar()); - yield return new WaitForSeconds(2); - StartCoroutine(BarMutilSerie()); - yield return new WaitForSeconds(3); - StartCoroutine(ZebraBar()); - yield return new WaitForSeconds(3); - StartCoroutine(SameBarAndNotStack()); - yield return new WaitForSeconds(3); - StartCoroutine(SameBarAndStack()); - yield return new WaitForSeconds(3); - StartCoroutine(SameBarAndPercentStack()); - yield return new WaitForSeconds(10); - - LoopDemo(); + while (true) + { + StartCoroutine(AddSimpleBar()); + yield return new WaitForSeconds(2); + StartCoroutine(BarMutilSerie()); + yield return new WaitForSeconds(3); + StartCoroutine(ZebraBar()); + yield return new WaitForSeconds(3); + StartCoroutine(SameBarAndNotStack()); + yield return new WaitForSeconds(3); + StartCoroutine(SameBarAndStack()); + yield return new WaitForSeconds(3); + StartCoroutine(SameBarAndPercentStack()); + yield return new WaitForSeconds(10); + } } IEnumerator AddSimpleBar() { chart = gameObject.GetComponent<BarChart>(); if (chart == null) chart = gameObject.AddComponent<BarChart>(); - chart.GetChartComponent<Title>().text = "BarChart - 柱状图"; - chart.GetChartComponent<Title>().subText = "普通柱状图"; + chart.EnsureChartComponent<Title>().text = "BarChart - 柱状图"; + chart.EnsureChartComponent<Title>().subText = "普通柱状图"; - var yAxis = chart.GetChartComponent<YAxis>(); + var yAxis = chart.EnsureChartComponent<YAxis>(); yAxis.minMaxType = Axis.AxisMinMaxType.Default; chart.RemoveData(); @@ -68,7 +58,7 @@ namespace XCharts.Example IEnumerator BarMutilSerie() { - chart.GetChartComponent<Title>().subText = "多条柱状图"; + chart.EnsureChartComponent<Title>().subText = "多条柱状图"; float now = serie.barWidth - 0.35f; while (serie.barWidth > 0.35f) @@ -90,7 +80,7 @@ namespace XCharts.Example IEnumerator ZebraBar() { - chart.GetChartComponent<Title>().subText = "斑马柱状图"; + chart.EnsureChartComponent<Title>().subText = "斑马柱状图"; serie.barType = BarType.Zebra; serie2.barType = BarType.Zebra; serie.barZebraWidth = serie.barZebraGap = 4; @@ -101,7 +91,7 @@ namespace XCharts.Example IEnumerator SameBarAndNotStack() { - chart.GetChartComponent<Title>().subText = "非堆叠同柱"; + chart.EnsureChartComponent<Title>().subText = "非堆叠同柱"; serie.barType = serie2.barType = BarType.Normal; serie.stack = ""; serie2.stack = ""; @@ -112,7 +102,7 @@ namespace XCharts.Example IEnumerator SameBarAndStack() { - chart.GetChartComponent<Title>().subText = "堆叠同柱"; + chart.EnsureChartComponent<Title>().subText = "堆叠同柱"; serie.barType = serie2.barType = BarType.Normal; serie.stack = "samename"; serie2.stack = "samename"; @@ -132,19 +122,25 @@ namespace XCharts.Example IEnumerator SameBarAndPercentStack() { - chart.GetChartComponent<Title>().subText = "百分比堆叠同柱"; + chart.EnsureChartComponent<Title>().subText = "百分比堆叠同柱"; serie.barType = serie2.barType = BarType.Normal; serie.stack = "samename"; serie2.stack = "samename"; serie.barPercentStack = true; - - serie.AddExtraComponent<LabelStyle>(); + if (null == serie.label) + { + serie.EnsureComponent<LabelStyle>(); + } serie.label.show = true; serie.label.position = LabelStyle.Position.Center; serie.label.textStyle.color = Color.white; serie.label.formatter = "{d:f0}%"; + if (null == serie2.label) + { + serie2.EnsureComponent<LabelStyle>(); + } serie2.label.show = true; serie2.label.position = LabelStyle.Position.Center; serie2.label.textStyle.color = Color.white; diff --git a/Examples/Example30_PieChart.cs b/Examples/Example30_PieChart.cs index e40f063c..a92d19b7 100644 --- a/Examples/Example30_PieChart.cs +++ b/Examples/Example30_PieChart.cs @@ -13,45 +13,37 @@ namespace XCharts.Example private float m_RadiusSpeed = 100f; private float m_CenterSpeed = 1f; - void Awake() - { - LoopDemo(); - } - private void OnEnable() { - LoopDemo(); - } - - void LoopDemo() - { - StopAllCoroutines(); StartCoroutine(PieDemo()); } IEnumerator PieDemo() { - StartCoroutine(PieAdd()); - yield return new WaitForSeconds(2); - StartCoroutine(PieShowLabel()); - yield return new WaitForSeconds(4); - StartCoroutine(Doughnut()); - yield return new WaitForSeconds(3); - StartCoroutine(DoublePie()); - yield return new WaitForSeconds(2); - StartCoroutine(RosePie()); - yield return new WaitForSeconds(5); - LoopDemo(); + while (true) + { + StartCoroutine(PieAdd()); + yield return new WaitForSeconds(2); + StartCoroutine(PieShowLabel()); + yield return new WaitForSeconds(4); + StartCoroutine(Doughnut()); + yield return new WaitForSeconds(3); + StartCoroutine(DoublePie()); + yield return new WaitForSeconds(2); + StartCoroutine(RosePie()); + yield return new WaitForSeconds(5); + } } IEnumerator PieAdd() { chart = gameObject.GetComponent<PieChart>(); if (chart == null) chart = gameObject.AddComponent<PieChart>(); + yield return null; chart.GetChartComponent<Title>().text = "PieChart - 饼图"; chart.GetChartComponent<Title>().subText = "基础饼图"; - var legend = chart.GetChartComponent<Legend>(); + var legend = chart.EnsureChartComponent<Legend>(); legend.show = true; legend.location.align = Location.Align.TopLeft; legend.location.top = 60; @@ -72,7 +64,7 @@ namespace XCharts.Example chart.AddData(0, 135, "视频广告"); chart.AddData(0, 1548, "搜索引擎"); - chart.onPointerClickPie = delegate(PointerEventData e, int serieIndex, int dataIndex) + chart.onSerieClick = delegate (SerieEventData data) { }; @@ -81,9 +73,9 @@ namespace XCharts.Example IEnumerator PieShowLabel() { - chart.GetChartComponent<Title>().subText = "显示文本标签"; + chart.EnsureChartComponent<Title>().subText = "显示文本标签"; - serie.AddExtraComponent<LabelStyle>(); + serie.EnsureComponent<LabelStyle>(); serie.label.show = true; chart.RefreshChart(); yield return new WaitForSeconds(1); @@ -105,7 +97,7 @@ namespace XCharts.Example IEnumerator Doughnut() { - chart.GetChartComponent<Title>().subText = "圆环图"; + chart.EnsureChartComponent<Title>().subText = "圆环图"; serie.radius[0] = 2f; while (serie.radius[0] < serie.radius[1] * 0.7f) { @@ -129,8 +121,7 @@ namespace XCharts.Example IEnumerator DoublePie() { - chart.GetChartComponent<Title>().subText = "多图组合"; - + chart.EnsureChartComponent<Title>().subText = "多图组合"; serie1 = chart.AddSerie<Pie>("访问来源2"); chart.AddData(1, 335, "直达"); chart.AddData(1, 679, "营销广告"); @@ -146,7 +137,14 @@ namespace XCharts.Example chart.RefreshChart(); yield return null; } - + if (null == serie.label) + { + serie.EnsureComponent<LabelStyle>(); + } + if (null == serie1.label) + { + serie1.EnsureComponent<LabelStyle>(); + } serie1.label.show = true; serie1.label.position = LabelStyle.Position.Inside; serie1.label.textStyle.color = Color.white; @@ -158,8 +156,8 @@ namespace XCharts.Example IEnumerator RosePie() { - chart.GetChartComponent<Title>().subText = "玫瑰图"; - chart.GetChartComponent<Legend>().show = false; + chart.EnsureChartComponent<Title>().subText = "玫瑰图"; + chart.EnsureChartComponent<Legend>().show = false; serie1.ClearData(); serie.ClearData(); serie1.radius = serie.radius = new float[2] { 0, 80 }; diff --git a/Examples/Example31_PieUpdateName.cs b/Examples/Example31_PieUpdateName.cs index 85091050..2c79e5d9 100644 --- a/Examples/Example31_PieUpdateName.cs +++ b/Examples/Example31_PieUpdateName.cs @@ -1,6 +1,8 @@ using UnityEngine; using XCharts.Runtime; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Example { [DisallowMultipleComponent] @@ -19,7 +21,7 @@ namespace XCharts.Example var serieIndex = 0; var serie = chart.GetSerie(serieIndex); if (serie == null) return; - serie.AddExtraComponent<LabelStyle>(); + serie.EnsureComponent<LabelStyle>(); serie.label.show = true; serie.label.position = LabelStyle.Position.Outside; } diff --git a/Examples/Example41_RadarUpdate.cs b/Examples/Example41_RadarUpdate.cs index baaa46be..7ed98895 100644 --- a/Examples/Example41_RadarUpdate.cs +++ b/Examples/Example41_RadarUpdate.cs @@ -1,6 +1,8 @@ using UnityEngine; using XCharts.Runtime; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Example { [DisallowMultipleComponent] diff --git a/Examples/Example60_Heatmap.cs b/Examples/Example60_Heatmap.cs index 2e89d4c3..263b6382 100644 --- a/Examples/Example60_Heatmap.cs +++ b/Examples/Example60_Heatmap.cs @@ -47,7 +47,7 @@ namespace XCharts.Example serie.itemStyle.borderColor = Color.clear; //设置高亮样式 - var emphasisStyle = serie.AddExtraComponent<EmphasisStyle>(); + var emphasisStyle = serie.EnsureComponent<EmphasisStyle>(); emphasisStyle.itemStyle.show = true; emphasisStyle.itemStyle.borderWidth = 1; emphasisStyle.itemStyle.borderColor = Color.black; diff --git a/Examples/Example80_Polar.cs b/Examples/Example80_Polar.cs index fdfb0b04..e5e202c5 100644 --- a/Examples/Example80_Polar.cs +++ b/Examples/Example80_Polar.cs @@ -1,6 +1,8 @@ using UnityEngine; using XCharts.Runtime; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Example { [DisallowMultipleComponent] @@ -17,7 +19,7 @@ namespace XCharts.Example { chart = gameObject.AddComponent<BaseChart>(); } - chart.GetOrAddChartComponent<PolarCoord>(); + chart.EnsureChartComponent<PolarCoord>(); } void Update() diff --git a/Examples/Example90_Candlestick.cs b/Examples/Example90_Candlestick.cs index 7218b6b9..736925c5 100644 --- a/Examples/Example90_Candlestick.cs +++ b/Examples/Example90_Candlestick.cs @@ -1,6 +1,8 @@ using UnityEngine; using XCharts.Runtime; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Example { [DisallowMultipleComponent] @@ -18,7 +20,7 @@ namespace XCharts.Example { chart = gameObject.AddComponent<CandlestickChart>(); } - GenerateOHLC(dataCount); + AddData(); } void Update() @@ -29,9 +31,7 @@ namespace XCharts.Example } } - void AddData() { } - - void GenerateOHLC(int count) + void AddData() { chart.ClearData(); @@ -40,7 +40,7 @@ namespace XCharts.Example var boxVals = new float[4]; var dayRange = 12; - for (int i = 0; i < count; i++) + for (int i = 0; i < dataCount; i++) { baseValue = baseValue + Random.Range(0f, 1f) * 30 - 10; for (int j = 0; j < 4; j++) diff --git a/Examples/Example_AddChart.cs b/Examples/Example_AddChart.cs index 80359764..143e03c7 100644 --- a/Examples/Example_AddChart.cs +++ b/Examples/Example_AddChart.cs @@ -1,5 +1,8 @@ using UnityEngine; using XCharts.Runtime; +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Example { @@ -30,22 +33,22 @@ namespace XCharts.Example chart.Init(); chart.SetSize(1200, 600); } - var title = chart.GetOrAddChartComponent<Title>(); + var title = chart.EnsureChartComponent<Title>(); title.text = "Simple LineChart"; title.subText = "normal line"; - var tooltip = chart.GetOrAddChartComponent<Tooltip>(); + var tooltip = chart.EnsureChartComponent<Tooltip>(); tooltip.show = true; - var legend = chart.GetOrAddChartComponent<Legend>(); + var legend = chart.EnsureChartComponent<Legend>(); legend.show = false; - var xAxis = chart.GetOrAddChartComponent<XAxis>(); + var xAxis = chart.EnsureChartComponent<XAxis>(); xAxis.splitNumber = 10; xAxis.boundaryGap = true; xAxis.type = Axis.AxisType.Category; - var yAxis = chart.GetOrAddChartComponent<YAxis>(); + var yAxis = chart.EnsureChartComponent<YAxis>(); yAxis.type = Axis.AxisType.Value; chart.RemoveData(); diff --git a/Examples/Example_Component.cs b/Examples/Example_Component.cs index 9847c970..d6a68a03 100644 --- a/Examples/Example_Component.cs +++ b/Examples/Example_Component.cs @@ -15,20 +15,20 @@ namespace XCharts.Example void ModifyComponent() { - var title = chart.GetOrAddChartComponent<Title>(); + var title = chart.EnsureChartComponent<Title>(); title.text = "Simple LineChart"; title.subText = "normal line"; var serie1 = chart.AddSerie<Line>(); //var serie2 = chart.GetSerie<Line>(); - serie1.AddExtraComponent<AreaStyle>(); - var label = serie1.AddExtraComponent<LabelStyle>(); + serie1.EnsureComponent<AreaStyle>(); + var label = serie1.EnsureComponent<LabelStyle>(); label.offset = new Vector3(0, 20, 0); var serieData = chart.AddData(0, 20); serieData.radius = 10; - var itemStyle = serieData.GetOrAddComponent<ItemStyle>(); + var itemStyle = serieData.EnsureComponent<ItemStyle>(); itemStyle.color = Color.blue; } } diff --git a/Examples/Example_Dynamic.cs b/Examples/Example_Dynamic.cs index b6a09a0d..260f490b 100644 --- a/Examples/Example_Dynamic.cs +++ b/Examples/Example_Dynamic.cs @@ -28,7 +28,7 @@ namespace XCharts.Example serie.symbol.show = false; serie.maxCache = maxCacheDataNumber; - var xAxis = chart.GetOrAddChartComponent<XAxis>(); + var xAxis = chart.EnsureChartComponent<XAxis>(); xAxis.maxCache = maxCacheDataNumber; timeNow = DateTime.Now; timeNow = timeNow.AddSeconds(-maxCacheDataNumber); diff --git a/Examples/Example_DynamicChart.cs b/Examples/Example_DynamicChart.cs index df35dfb1..24b9f26a 100644 --- a/Examples/Example_DynamicChart.cs +++ b/Examples/Example_DynamicChart.cs @@ -1,6 +1,8 @@ using UnityEngine; using XCharts.Runtime; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Example { [DisallowMultipleComponent] @@ -43,11 +45,11 @@ namespace XCharts.Example chart.Init(); chart.SetSize(580, 300); - chart.GetOrAddChartComponent<Title>().show = true; - chart.GetOrAddChartComponent<Title>().text = chartName; + chart.EnsureChartComponent<Title>().show = true; + chart.EnsureChartComponent<Title>().text = chartName; - chart.GetOrAddChartComponent<Tooltip>().show = true; - chart.GetOrAddChartComponent<Legend>().show = true; + chart.EnsureChartComponent<Tooltip>().show = true; + chart.EnsureChartComponent<Legend>().show = true; chart.RemoveData(); chart.AddSerie<Pie>(); @@ -65,16 +67,16 @@ namespace XCharts.Example chart.Init(); chart.SetSize(580, 300); - chart.GetOrAddChartComponent<Title>().show = true; - chart.GetOrAddChartComponent<Title>().text = chartName; + chart.EnsureChartComponent<Title>().show = true; + chart.EnsureChartComponent<Title>().text = chartName; - chart.GetOrAddChartComponent<Legend>().show = false; + chart.EnsureChartComponent<Legend>().show = false; - var tooltip = chart.GetOrAddChartComponent<Tooltip>(); + var tooltip = chart.EnsureChartComponent<Tooltip>(); tooltip.trigger = Tooltip.Trigger.Axis; - var xAxis = chart.GetOrAddChartComponent<XAxis>(); - var yAxis = chart.GetOrAddChartComponent<YAxis>(); + var xAxis = chart.EnsureChartComponent<XAxis>(); + var yAxis = chart.EnsureChartComponent<YAxis>(); xAxis.splitNumber = 10; xAxis.boundaryGap = true; xAxis.show = true; diff --git a/Examples/Example_Test.cs b/Examples/Example_Test.cs index e51b0ac9..b70b7c5c 100644 --- a/Examples/Example_Test.cs +++ b/Examples/Example_Test.cs @@ -1,7 +1,10 @@ using UnityEngine; +using UnityEngine.EventSystems; using UnityEngine.UI; using XCharts.Runtime; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Example { [DisallowMultipleComponent] @@ -12,6 +15,9 @@ namespace XCharts.Example void Awake() { chart = gameObject.GetComponent<BaseChart>(); + chart.onSerieClick = OnPointerClickLine; + chart.onSerieEnter = OnPointerEnterLine; + chart.onSerieExit = OnPointerExitLine; var btnTrans = transform.parent.Find("Button"); if (btnTrans) { @@ -19,6 +25,21 @@ namespace XCharts.Example } } + void OnPointerClickLine(SerieEventData data) + { + Debug.Log("OnPointerClick: " + data.serieIndex+ " " + data.dataIndex +" "+ data.dimension); + } + + void OnPointerEnterLine(SerieEventData data) + { + Debug.Log("OnPointerEnter: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension); + } + + void OnPointerExitLine(SerieEventData data) + { + Debug.Log("OnPointerExit: " + data.serieIndex + " " + data.dataIndex + " " + data.dimension); + } + void Update() { if (Input.GetKeyDown(KeyCode.Space)) diff --git a/Examples/Example_TestTime.cs b/Examples/Example_TestTime.cs index 59f813d2..1ed2804b 100644 --- a/Examples/Example_TestTime.cs +++ b/Examples/Example_TestTime.cs @@ -1,6 +1,8 @@ using UnityEngine; using XCharts.Runtime; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Example { [DisallowMultipleComponent] diff --git a/Examples/XCharts.Examples.asmdef b/Examples/XCharts.Examples.asmdef index 638b2960..2428dbeb 100644 --- a/Examples/XCharts.Examples.asmdef +++ b/Examples/XCharts.Examples.asmdef @@ -10,5 +10,6 @@ "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [] + "defineConstraints": [], + "versionDefines": [] } \ No newline at end of file diff --git a/README-en.md b/README-en.md index 3d8045ee..3438bdd1 100644 --- a/README-en.md +++ b/README-en.md @@ -110,7 +110,7 @@ A powerful, easy-to-use, configurable charting and data visualization library fo ![extendchart](Documentation~/en/img/readme_extendchart.png) -For more examples, see [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo), You can also go to [Online Demo](https://xcharts-team.github.io/demo/) to see the running effect of `WebGL`. +For more examples, see [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo), You can also go to [Online Demo](https://xcharts-team.github.io/examples/) to see the running effect of `WebGL`. ## Use diff --git a/README.md b/README.md index dd1d3b8a..53fc5420 100644 --- a/README.md +++ b/README.md @@ -18,27 +18,27 @@ <a href="https://github.com/XCharts-Team/XCharts/releases"> <img src="https://img.shields.io/github/v/release/XCharts-Team/XCharts?include_prereleases"></img> </a> - <a href=""> + <a href="https://github.com/XCharts-Team/XCharts"> <img src="https://img.shields.io/github/repo-size/monitor1394/unity-ugui-xcharts"></img> </a> - <a href=""> + <a href="https://github.com/XCharts-Team/XCharts"> <img src="https://img.shields.io/github/languages/code-size/monitor1394/unity-ugui-xcharts"></img> </a> - <a href=""> + <a href="https://xcharts-team.github.io/docs/tutorial01"> <img src="https://img.shields.io/badge/Unity-5.6+-green"></img> </a> - <a href=""> + <a href="https://xcharts-team.github.io/docs/tutorial01"> <img src="https://img.shields.io/badge/TextMeshPro-YES-green"></img> </a> </p> <p align="center"> - <a href=""> + <a href="https://github.com/XCharts-Team/XCharts/stargazers"> <img src="https://img.shields.io/github/stars/XCharts-Team/XCharts?style=social"></img> </a> - <a href=""> + <a href="https://github.com/XCharts-Team/XCharts/forks"> <img src="https://img.shields.io/github/forks/XCharts-Team/XCharts?style=social"></img> </a> - <a href=""> + <a href="https://github.com/XCharts-Team/XCharts/issues"> <img src="https://img.shields.io/github/issues-closed/XCharts-Team/XCharts?color=green&label=%20%20%20%20issues&logoColor=green&style=social"></img> </a> </p> @@ -46,13 +46,14 @@ 一款基于`UGUI`的功能强大、简单易用的数据可视化图表插件。支持`折线图`、`柱状图`、`饼图`、`雷达图`、`散点图`、`热力图`、`环形图`、`K线图`、`极坐标`、`平行坐标`等十多种内置图表,以及`3D饼图`、`3D柱图`、`3D金字塔`、`漏斗图`、`仪表盘`、`水位图`、`象形柱图`、`甘特图`、`矩形树图`等扩展图表。 [XCharts3.0 官方主页](https://xcharts-team.github.io) +[XCharts3.0 在线示例](https://xcharts-team.github.io/examples) -[XCharts3.0 教程](Documentation~/zh/tutorial01.md) -[XCharts3.0 API](Documentation~/zh/api.md) -[XCharts3.0 问答](Documentation~/zh/faq.md) -[XCharts3.0 配置项手册](Documentation~/zh/configuration.md) -[XCharts3.0 更新日志](Documentation~/zh/changelog.md) -[XCharts3.0 订阅服务](Documentation~/zh/support.md) +[XCharts3.0 教程](Documentation~/zh/tutorial01.md) +[XCharts3.0 API](Documentation~/zh/api.md) +[XCharts3.0 问答](Documentation~/zh/faq.md) +[XCharts3.0 配置项手册](Documentation~/zh/configuration.md) +[XCharts3.0 更新日志](Documentation~/zh/changelog.md) +[XCharts3.0 订阅服务](Documentation~/zh/support.md) ## 特性 @@ -70,6 +71,7 @@ - 支持万级大数据量绘制,支持采样绘制。 - 支持`TexMeshPro`。 - 支持所有`5.6`以上的`Unity`版本。 +- 支持 Input System ([如何从 Input Manager 转 Input System](https://xcharts-team.github.io/docs/inputsystem))。 ## 截图 @@ -77,40 +79,14 @@ ![扩展图表](Documentation~/zh/img/readme_extendchart.png) -XCharts不再内置Demo,Demo已独立出单独的仓库 [XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo),也可以在浏览器查看`WebGL`下的运行效果 [在线Demo](https://xcharts-team.github.io/demo/) 。 - -## `XCharts3.0` - -- 增加`Time`时间轴。 -- 增加`SingleAxis`单轴。 -- 增加多种坐标系:`Grid`、`Polar`、`Radar`、`SingleAxis`。 -- 增加多种动画方式。 -- 增加多种图表交互。 -- 增加国际化支持。 -- 增加`Widgets`小组件。 -- 增加多种扩展图表。 - -## `XCharts3.0` 相比 `XCharts2.0` - -- 更健壮的底层框架。 -- 更强大的性能。 -- 更小的序列化文件。 -- 更好的交互体验。 -- 更多的组件支持。 -- 更强大的文本自述能力。 -- 更合理的组件调整。 -- 更灵活的组件插拔。 -- 更高效的二次开发。 -- 更丰富的Demo示例。 - ![XCharts 3.0和2.0的对比](Documentation~/zh/img/readme_xcharts3.png) ## 注意 -- `XCharts3.0` 不完全兼容 `XCharts2.0` 版本,升级`3.0`可能需要调整部分代码和配置。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。 -- `XCharts2.0` 进入维护阶段,后续只修复严重`bug`,理论上不再加新功能。 +- `XCharts3.0` 不完全兼容 `XCharts2.0` 版本,升级`3.0`可能需要调整部分代码,图表部分配置需要重新调整。建议旧项目可以继续使用`XCharts2.0`,新项目推荐使用`XCharts3.0`。 +- `XCharts2.0` 进入维护阶段,后续只修复严重`bug`,原则上不再加新功能。 - `XCharts` 理论上支持`Unity 5.6`及以上版本,但由于版本测试有限难免疏漏,发现版本兼容问题可提`Issue`。 -- 本仓库只包含`XCharts`源码,不包含`Demo`示例部分。需要查看`Demo`请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。 +- 本仓库只包含`XCharts`源码,不包含`Demo`示例部分。需要查看`Demo`示例源码请到[XCharts-Demo](https://github.com/XCharts-Team/XCharts-Demo)仓库。也可以在浏览器查看`WebGL`下的运行效果 [在线Demo](https://xcharts-team.github.io/examples/) 。 ## 使用 @@ -118,7 +94,7 @@ XCharts不再内置Demo,Demo已独立出单独的仓库 [XCharts-Demo](https:/ 2. 在`Hierarchy`视图下右键选择`XCharts->LineChart`,即可创建一个默认的折线图。 3. 在`Inspector`视图可以调整各个组件的参数,`Game`视图可看到实时效果。 -- 更多使用细节,请看:[XCharts教程:5分钟上手教程](Documentation~/zh/tutorial01.md) +- 更多细节,请看:[XCharts教程:5分钟上手教程](Documentation~/zh/tutorial01.md) - 首次使用,建议先认真看一遍教程。 ## 分支 @@ -130,13 +106,18 @@ XCharts不再内置Demo,Demo已独立出单独的仓库 [XCharts-Demo](https:/ - `1.0`:XCharts 1.0的稳定分支。带Demo,不再维护。 - `1.0-upm`:XCharts 1.0的稳定UMP分支。不带Demo,不再维护。 +## 扩展 + +- [扩展图表](https://xcharts-team.github.io/docs/extra) 扩展图表订阅`VIP`后再按需购买,订阅详情请查看[☞ 看这里](Documentation~/zh/support.md) +- [扩展组件](https://xcharts-team.github.io/docs/ui) 扩展组件订阅`VIP`后即可免费使用。 + ## FAQ 1. `XCharts`可以免费使用吗? 答:`XCharts`使用`MIT`协议,可以免费使用。也可以订阅`VIP`享受更多增值服务。 2. `XCharts`支持代码动态添加和修改数据吗?支持从`Excel`或数据库中获取数据吗? - 答:`XCharts`提供了各种数据操作的接口,支持代码动态修改配置,添加和修改数据,但数据来源需要自己解析或获取,再调用`XCharts`的接口添加到`XCharts`。 + 答:`XCharts`提供了各种数据操作的接口,支持代码动态修改配置,添加和修改数据,但数据来源需要自己解析和获取,再调用`XCharts`的接口添加到图表。 3. 这个插件除了用在`Unity`,还能用在其他平台(如`Winform`或`WPF`)吗? 答:目前只支持在`Unity`平台使用。理论上任何支持`UGUI`的`Unity`版本都能运行`XCharts`。 @@ -160,4 +141,4 @@ XCharts不再内置Demo,Demo已独立出单独的仓库 [XCharts-Demo](https:/ - 邮箱:`monitor1394@gmail.com` - QQ群:XCharts交流群(`202030963`) - VIP群:XCharts技术支持VIP群(`867291970`) -- 捐助、合作和技术支持:[☞ 看这里](Documentation~/zh/support.md) +- 捐助、合作、订阅和技术支持:[☞ 看这里](Documentation~/zh/support.md) diff --git a/Runtime/Chart/BarChart.cs b/Runtime/Chart/BarChart.cs index 65cb0d73..a8284f86 100644 --- a/Runtime/Chart/BarChart.cs +++ b/Runtime/Chart/BarChart.cs @@ -14,7 +14,7 @@ namespace XCharts.Runtime AddChartComponentWhenNoExist<XAxis>(); AddChartComponentWhenNoExist<YAxis>(); - var tooltip = GetOrAddChartComponent<Tooltip>(); + var tooltip = EnsureChartComponent<Tooltip>(); tooltip.type = Tooltip.Type.Shadow; tooltip.trigger = Tooltip.Trigger.Axis; diff --git a/Runtime/Chart/CandlestickChart.cs b/Runtime/Chart/CandlestickChart.cs index be7e0263..62bf4666 100644 --- a/Runtime/Chart/CandlestickChart.cs +++ b/Runtime/Chart/CandlestickChart.cs @@ -14,7 +14,7 @@ namespace XCharts.Runtime AddChartComponentWhenNoExist<XAxis>(); AddChartComponentWhenNoExist<YAxis>(); - var tooltip = GetOrAddChartComponent<Tooltip>(); + var tooltip = EnsureChartComponent<Tooltip>(); tooltip.type = Tooltip.Type.Shadow; tooltip.trigger = Tooltip.Trigger.Axis; diff --git a/Runtime/Chart/HeatmapChart.cs b/Runtime/Chart/HeatmapChart.cs index f1df5f11..3bdcda09 100644 --- a/Runtime/Chart/HeatmapChart.cs +++ b/Runtime/Chart/HeatmapChart.cs @@ -15,15 +15,15 @@ namespace XCharts.Runtime tooltip.type = Tooltip.Type.None; tooltip.trigger = Tooltip.Trigger.Axis; - var grid = GetOrAddChartComponent<GridCoord>(); + var grid = EnsureChartComponent<GridCoord>(); grid.left = 0.12f; - var xAxis = GetOrAddChartComponent<XAxis>(); + var xAxis = EnsureChartComponent<XAxis>(); xAxis.type = Axis.AxisType.Category; xAxis.boundaryGap = true; xAxis.splitNumber = 10; - var yAxis = GetOrAddChartComponent<YAxis>(); + var yAxis = EnsureChartComponent<YAxis>(); yAxis.type = Axis.AxisType.Category; yAxis.boundaryGap = true; yAxis.splitNumber = 10; @@ -35,7 +35,7 @@ namespace XCharts.Runtime Heatmap.AddDefaultSerie(this, GenerateDefaultSerieName()); - var visualMap = GetOrAddChartComponent<VisualMap>(); + var visualMap = EnsureChartComponent<VisualMap>(); visualMap.autoMinMax = true; visualMap.orient = Orient.Vertical; visualMap.calculable = true; diff --git a/Runtime/Chart/LineChart.cs b/Runtime/Chart/LineChart.cs index c5317f5c..bc1dc084 100644 --- a/Runtime/Chart/LineChart.cs +++ b/Runtime/Chart/LineChart.cs @@ -14,7 +14,7 @@ namespace XCharts.Runtime AddChartComponentWhenNoExist<XAxis>(); AddChartComponentWhenNoExist<YAxis>(); - var tooltip = GetOrAddChartComponent<Tooltip>(); + var tooltip = EnsureChartComponent<Tooltip>(); tooltip.type = Tooltip.Type.Line; tooltip.trigger = Tooltip.Trigger.Axis; diff --git a/Runtime/Chart/PieChart.cs b/Runtime/Chart/PieChart.cs index f6ef9d32..0cee6a3a 100644 --- a/Runtime/Chart/PieChart.cs +++ b/Runtime/Chart/PieChart.cs @@ -10,7 +10,7 @@ namespace XCharts.Runtime { protected override void DefaultChart() { - var legend = GetOrAddChartComponent<Legend>(); + var legend = EnsureChartComponent<Legend>(); legend.show = true; RemoveData(); diff --git a/Runtime/Chart/ScatterChart.cs b/Runtime/Chart/ScatterChart.cs index a6ce4d97..9f44c902 100644 --- a/Runtime/Chart/ScatterChart.cs +++ b/Runtime/Chart/ScatterChart.cs @@ -12,15 +12,15 @@ namespace XCharts.Runtime { AddChartComponentWhenNoExist<GridCoord>(); - var tooltip = GetOrAddChartComponent<Tooltip>(); + var tooltip = EnsureChartComponent<Tooltip>(); tooltip.type = Tooltip.Type.None; tooltip.trigger = Tooltip.Trigger.Item; - var xAxis = GetOrAddChartComponent<XAxis>(); + var xAxis = EnsureChartComponent<XAxis>(); xAxis.type = Axis.AxisType.Value; xAxis.boundaryGap = false; - var yAxis = GetOrAddChartComponent<YAxis>(); + var yAxis = EnsureChartComponent<YAxis>(); yAxis.type = Axis.AxisType.Value; yAxis.boundaryGap = false; diff --git a/Runtime/Component/Animation/AnimationStyle.cs b/Runtime/Component/Animation/AnimationStyle.cs index 586e66a3..beaabd01 100644 --- a/Runtime/Component/Animation/AnimationStyle.cs +++ b/Runtime/Component/Animation/AnimationStyle.cs @@ -622,7 +622,7 @@ namespace XCharts.Runtime public float GetUpdateAnimationDuration() { - if (m_Enable && m_DataChangeEnable && IsFinish()) + if (m_Enable && m_DataChangeEnable) return m_DataChangeDuration; else return 0; diff --git a/Runtime/Component/Axis/Axis.cs b/Runtime/Component/Axis/Axis.cs index 6e2a4aa9..2c4ca54d 100644 --- a/Runtime/Component/Axis/Axis.cs +++ b/Runtime/Component/Axis/Axis.cs @@ -576,13 +576,7 @@ namespace XCharts.Runtime { total = context.labelValueList.Count; } - var labelShow = axisLabel.show && (axisLabel.interval == 0 || index % (axisLabel.interval + 1) == 0); - if (labelShow) - { - if (!axisLabel.showStartLabel && index == 0) labelShow = false; - else if (!axisLabel.showEndLabel && index == total - 1) labelShow = false; - } - return labelShow; + return axisLabel.IsNeedShowLabel(index, total); } public void SetNeedUpdateFilterData() @@ -827,18 +821,18 @@ namespace XCharts.Runtime return logBaseE ? (float) Math.Log(value) : (float) Math.Log(value, logBase); } - public int GetLogMinIndex() + public double GetLogMinIndex() { return logBaseE ? - (int) Math.Log(context.minValue) : - (int) Math.Log(context.minValue, logBase); + Math.Log(context.minValue) : + Math.Log(context.minValue, logBase); } - public int GetLogMaxIndex() + public double GetLogMaxIndex() { return logBaseE ? - (int) Math.Log(context.maxValue) : - (int) Math.Log(context.maxValue, logBase); + Math.Log(context.maxValue) : + Math.Log(context.maxValue, logBase); } public double GetLabelValue(int index) diff --git a/Runtime/Component/Axis/AxisHelper.cs b/Runtime/Component/Axis/AxisHelper.cs index ea78584a..cf6e5896 100644 --- a/Runtime/Component/Axis/AxisHelper.cs +++ b/Runtime/Component/Axis/AxisHelper.cs @@ -65,9 +65,10 @@ namespace XCharts.Runtime if (axis.splitNumber <= 0) { var eachWid = coordinateWid / dataCount; - if (eachWid > 80) return dataCount; - var tick = Mathf.CeilToInt(80 / eachWid); - return (int) (dataCount / tick); + var min = axis is YAxis ? 20 : 80; + if (eachWid > min) return dataCount; + var tick = Mathf.CeilToInt(min / eachWid); + return (int)(dataCount / tick); } else { @@ -131,7 +132,7 @@ namespace XCharts.Runtime maxValue = -maxValue; } if (forcePercent) - return string.Format("{0}%", (int) value); + return string.Format("{0}%", (int)value); else return axis.axisLabel.GetFormatterContent(index, value, minValue, maxValue); } @@ -218,7 +219,7 @@ namespace XCharts.Runtime if (axis.boundaryGap) { - scaleNum = dataCount > 2 && dataCount % splitNum == 0 ? + scaleNum = dataCount > 1 && dataCount % splitNum == 0 ? splitNum + 1 : splitNum + 2; } @@ -254,9 +255,8 @@ namespace XCharts.Runtime { var value = axis.GetLabelValue(index); var lastValue = axis.GetLabelValue(index - 1); - return axis.context.minMaxRange == 0 ? - 0 : - (float) (coordinateWidth * (value - lastValue) / axis.context.minMaxRange); + return axis.context.minMaxRange == 0 ? 0 : + (float)(coordinateWidth * (value - lastValue) / axis.context.minMaxRange); } else { @@ -344,7 +344,10 @@ namespace XCharts.Runtime int maxSplit = 0; maxValue = ChartHelper.GetMaxLogValue(maxValue, axis.logBase, axis.logBaseE, out maxSplit); minValue = ChartHelper.GetMinLogValue(minValue, axis.logBase, axis.logBaseE, out minSplit); - axis.splitNumber = (minSplit > 0 && maxSplit > 0) ? (maxSplit + minSplit - 1) : (maxSplit + minSplit); + var splitNumber = (minSplit > 0 && maxSplit > 0) ? (maxSplit + minSplit - 1) : (maxSplit + minSplit); + if (splitNumber > 15) + splitNumber = 15; + axis.splitNumber = splitNumber; return; } if (axis.type == Axis.AxisType.Time) { } @@ -459,7 +462,7 @@ namespace XCharts.Runtime if (axis.IsCategory()) { if (dataCount == 0) dataCount = axis.data.Count; - var categoryIndex = (int) value; + var categoryIndex = (int)value; var scaleWid = AxisHelper.GetDataWidth(axis, gridHeight, dataCount, dataZoom); float startY = gridXY + (axis.boundaryGap ? scaleWid / 2 : 0); return startY + scaleWid * categoryIndex; @@ -467,9 +470,8 @@ namespace XCharts.Runtime else { var yDataHig = (axis.context.minMaxRange == 0) ? 0f : - (float) ((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight); + (float)((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight); return gridXY + yDataHig; - } } @@ -538,7 +540,7 @@ namespace XCharts.Runtime { if (axis.IsCategory()) { - return (int) value; + return (int)value; } else { @@ -549,9 +551,9 @@ namespace XCharts.Runtime if (totalSplitNumber == -1) totalSplitNumber = GetTotalSplitGridNum(axis); if (axis.minMaxType == Axis.AxisMinMaxType.Custom) - return Mathf.CeilToInt(((float) ((value - axis.min) / axis.max) * totalSplitNumber) - 1); + return Mathf.CeilToInt(((float)((value - axis.min) / axis.max) * totalSplitNumber) - 1); else - return Mathf.CeilToInt(((float) ((value - axis.context.minValue) / axis.context.minMaxRange) * totalSplitNumber) - 1); + return Mathf.CeilToInt(((float)((value - axis.context.minValue) / axis.context.minMaxRange) * totalSplitNumber) - 1); } } } @@ -564,15 +566,15 @@ namespace XCharts.Runtime if (axis.IsLog()) { - int minIndex = axis.GetLogMinIndex(); - float nowIndex = axis.GetLogValue(value); + var minIndex = axis.GetLogMinIndex(); + var nowIndex = axis.GetLogValue(value); return includeGridXY ? - gridXY + (nowIndex - minIndex) / axis.splitNumber * gridHeight : - (nowIndex - minIndex) / axis.splitNumber * gridHeight; + (float)(gridXY + (nowIndex - minIndex) / axis.splitNumber * gridHeight) : + (float)((nowIndex - minIndex) / axis.splitNumber * gridHeight); } else if (axis.IsCategory()) { - var categoryIndex = (int) value; + var categoryIndex = (int)value; return includeGridXY ? gridXY + (axis.boundaryGap ? scaleWidth / 2 : 0) + scaleWidth * categoryIndex : (axis.boundaryGap ? scaleWidth / 2 : 0) + scaleWidth * categoryIndex; @@ -583,9 +585,9 @@ namespace XCharts.Runtime if (axis.context.minMaxRange != 0) { if (realLength) - yDataHig = (float) (value * gridHeight / axis.context.minMaxRange); + yDataHig = (float)(value * gridHeight / axis.context.minMaxRange); else - yDataHig = (float) ((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight); + yDataHig = (float)((value - axis.context.minValue) / axis.context.minMaxRange * gridHeight); } return includeGridXY ? gridXY + yDataHig : diff --git a/Runtime/Component/Axis/AxisLabel.cs b/Runtime/Component/Axis/AxisLabel.cs index 934f5e0d..0daf6836 100644 --- a/Runtime/Component/Axis/AxisLabel.cs +++ b/Runtime/Component/Axis/AxisLabel.cs @@ -96,10 +96,10 @@ namespace XCharts.Runtime return new AxisLabel() { m_Show = true, - m_Interval = 0, - m_Inside = false, - m_Distance = 8, - m_TextStyle = new TextStyle(), + m_Interval = 0, + m_Inside = false, + m_Distance = 8, + m_TextStyle = new TextStyle(), }; } } @@ -168,5 +168,16 @@ namespace XCharts.Runtime } return base.GetFormatterContent(labelIndex, value, minValue, maxValue, isLog); } + + public bool IsNeedShowLabel(int index, int total) + { + var labelShow = show && (interval == 0 || index % (interval + 1) == 0); + if (labelShow) + { + if (!showStartLabel && index == 0) labelShow = false; + else if (!showEndLabel && index == total - 1) labelShow = false; + } + return labelShow; + } } } \ No newline at end of file diff --git a/Runtime/Component/Background/Background.cs b/Runtime/Component/Background/Background.cs index 68f212ce..bd230cf4 100644 --- a/Runtime/Component/Background/Background.cs +++ b/Runtime/Component/Background/Background.cs @@ -6,8 +6,7 @@ namespace XCharts.Runtime { /// <summary> /// Background component. - /// | - /// 背景组件。 + /// |背景组件。 /// </summary> [Serializable] [DisallowMultipleComponent] @@ -27,7 +26,7 @@ namespace XCharts.Runtime public bool show { get { return m_Show; } - internal set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); } + set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); } } /// <summary> /// the image of background. diff --git a/Runtime/Component/Background/BackgroundHandler.cs b/Runtime/Component/Background/BackgroundHandler.cs index e99535c0..77c6d8ff 100644 --- a/Runtime/Component/Background/BackgroundHandler.cs +++ b/Runtime/Component/Background/BackgroundHandler.cs @@ -19,7 +19,7 @@ namespace XCharts.Runtime component.gameObject = backgroundObj; backgroundObj.hideFlags = chart.chartHideFlags; - var backgroundImage = ChartHelper.GetOrAddComponent<Image>(backgroundObj); + var backgroundImage = ChartHelper.EnsureComponent<Image>(backgroundObj); ChartHelper.UpdateRectTransform(backgroundObj, chart.chartMinAnchor, chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta); backgroundImage.sprite = component.image; diff --git a/Runtime/Component/Child/AreaStyle.cs b/Runtime/Component/Child/AreaStyle.cs index 66984923..783555ac 100644 --- a/Runtime/Component/Child/AreaStyle.cs +++ b/Runtime/Component/Child/AreaStyle.cs @@ -7,7 +7,7 @@ namespace XCharts.Runtime /// |区域填充样式。 /// </summary> [System.Serializable] - public class AreaStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent + public class AreaStyle : ChildComponent, ISerieComponent, ISerieDataComponent { /// <summary> /// Origin position of area. @@ -38,6 +38,7 @@ namespace XCharts.Runtime [SerializeField] private Color32 m_ToColor; [SerializeField][Range(0, 1)] private float m_Opacity = 0.6f; [SerializeField][Since("v3.2.0")] private bool m_InnerFill; + [SerializeField][Since("v3.6.0")] private bool m_ToTop = true; /// <summary> /// Set this to false to prevent the areafrom showing. @@ -93,6 +94,16 @@ namespace XCharts.Runtime get { return m_InnerFill; } set { if (PropertyUtil.SetStruct(ref m_InnerFill, value)) SetVerticesDirty(); } } + /// <summary> + /// Whether to fill the gradient color to the top. The default is true, which means that the gradient color is filled to the top. + /// If it is false, the gradient color is filled to the actual position. + /// |渐变色是到顶部还是到实际位置。默认为true到顶部。 + /// </summary> + public bool toTop + { + get { return m_ToTop; } + set { if (PropertyUtil.SetStruct(ref m_ToTop, value)) SetVerticesDirty(); } + } public Color32 GetColor() { diff --git a/Runtime/Component/Child/ImageStyle.cs b/Runtime/Component/Child/ImageStyle.cs index d37b3921..d48582fb 100644 --- a/Runtime/Component/Child/ImageStyle.cs +++ b/Runtime/Component/Child/ImageStyle.cs @@ -4,7 +4,7 @@ using UnityEngine.UI; namespace XCharts.Runtime { [System.Serializable] - public class ImageStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent + public class ImageStyle : ChildComponent, ISerieComponent, ISerieDataComponent { [SerializeField] private bool m_Show = true; [SerializeField] private Sprite m_Sprite; diff --git a/Runtime/Component/Child/ItemStyle.cs b/Runtime/Component/Child/ItemStyle.cs index 79e9403a..56437837 100644 --- a/Runtime/Component/Child/ItemStyle.cs +++ b/Runtime/Component/Child/ItemStyle.cs @@ -13,6 +13,7 @@ namespace XCharts.Runtime [SerializeField] private Color32 m_Color0; [SerializeField] private Color32 m_ToColor; [SerializeField] private Color32 m_ToColor2; + [SerializeField][Since("v3.6.0")] private Color32 m_MarkColor; [SerializeField] private Color32 m_BackgroundColor; [SerializeField] private float m_BackgroundWidth; [SerializeField] private Color32 m_CenterColor; @@ -35,6 +36,7 @@ namespace XCharts.Runtime m_Color0 = Color.clear; m_ToColor = Color.clear; m_ToColor2 = Color.clear; + m_MarkColor = Color.clear; m_BackgroundColor = Color.clear; m_BackgroundWidth = 0; m_CenterColor = Color.clear; @@ -102,6 +104,15 @@ namespace XCharts.Runtime set { if (PropertyUtil.SetColor(ref m_ToColor2, value)) SetVerticesDirty(); } } /// <summary> + /// Serie's mark color. It is only used to display Legend and Tooltip, and does not affect the drawing color. The default value is clear. + /// |Serie的标识颜色。仅用于Legend和Tooltip的展示,不影响绘制颜色,默认为clear。 + /// </summary> + public Color32 markColor + { + get { return m_MarkColor; } + set { if (PropertyUtil.SetStruct(ref m_MarkColor, value)) { SetAllDirty(); } } + } + /// <summary> /// 数据项背景颜色。 /// </summary> public Color32 backgroundColor diff --git a/Runtime/Component/Child/LineArrow.cs b/Runtime/Component/Child/LineArrow.cs index 8b45aa84..ed45a0e2 100644 --- a/Runtime/Component/Child/LineArrow.cs +++ b/Runtime/Component/Child/LineArrow.cs @@ -6,7 +6,7 @@ namespace XCharts.Runtime /// <summary> /// </summary> [Serializable] - public class LineArrow : ChildComponent, ISerieExtraComponent + public class LineArrow : ChildComponent, ISerieComponent { public enum Position { diff --git a/Runtime/Component/Child/Location.cs b/Runtime/Component/Child/Location.cs index 819e3560..cc576bd2 100644 --- a/Runtime/Component/Child/Location.cs +++ b/Runtime/Component/Child/Location.cs @@ -125,10 +125,10 @@ namespace XCharts.Runtime return new Location() { align = Align.CenterLeft, - left = 0.03f, - right = 0, - top = 0, - bottom = 0 + left = 0.03f, + right = 0, + top = 0, + bottom = 0 }; } } @@ -140,10 +140,10 @@ namespace XCharts.Runtime return new Location() { align = Align.CenterRight, - left = 0, - right = 0.03f, - top = 0, - bottom = 0 + left = 0, + right = 0.03f, + top = 0, + bottom = 0 }; } } @@ -155,10 +155,10 @@ namespace XCharts.Runtime return new Location() { align = Align.TopCenter, - left = 0, - right = 0, - top = 0.03f, - bottom = 0 + left = 0, + right = 0, + top = 0.03f, + bottom = 0 }; } } @@ -170,10 +170,10 @@ namespace XCharts.Runtime return new Location() { align = Align.BottomCenter, - left = 0, - right = 0, - top = 0, - bottom = 0.03f + left = 0, + right = 0, + top = 0, + bottom = 0.03f }; } } @@ -268,6 +268,46 @@ namespace XCharts.Runtime } } + public bool IsBottom() + { + switch (m_Align) + { + case Align.BottomCenter: + case Align.BottomLeft: + case Align.BottomRight: + + return true; + default: + return false; + } + } + + public bool IsTop() + { + switch (m_Align) + { + case Align.TopCenter: + case Align.TopLeft: + case Align.TopRight: + return true; + default: + return false; + } + } + + public bool IsCenter() + { + switch (m_Align) + { + case Align.Center: + case Align.CenterLeft: + case Align.CenterRight: + return true; + default: + return false; + } + } + public void UpdateRuntimeData(float chartWidth, float chartHeight) { runtimeLeft = left <= 1 ? left * chartWidth : left; diff --git a/Runtime/Component/DataZoom/DataZoom.cs b/Runtime/Component/DataZoom/DataZoom.cs index 030a0c52..84cf83ad 100644 --- a/Runtime/Component/DataZoom/DataZoom.cs +++ b/Runtime/Component/DataZoom/DataZoom.cs @@ -81,8 +81,6 @@ namespace XCharts.Runtime [SerializeField] private RangeMode m_RangeMode; [SerializeField] private float m_Start; [SerializeField] private float m_End; - //[SerializeField] private float m_StartValue; - //[SerializeField] private float m_EndValue; [SerializeField] private int m_MinShowNum = 1; [Range(1f, 20f)] [SerializeField] private float m_ScrollSensitivity = 1.1f; @@ -91,8 +89,11 @@ namespace XCharts.Runtime [SerializeField] private LineStyle m_LineStyle = new LineStyle(LineStyle.Type.Solid); [SerializeField] private AreaStyle m_AreaStyle = new AreaStyle(); [SerializeField][Since("v3.5.0")] private MarqueeStyle m_MarqueeStyle = new MarqueeStyle(); + [SerializeField][Since("v3.6.0")] private bool m_StartLock; + [SerializeField][Since("v3.6.0")] private bool m_EndLock; public DataZoomContext context = new DataZoomContext(); + private CustomDataZoomStartEndFunction m_StartEndFunction; /// <summary> /// Whether to show dataZoom. @@ -305,6 +306,24 @@ namespace XCharts.Runtime set { m_Start = value; if (m_Start < 0) m_Start = 0; if (m_Start > 100) m_Start = 100; SetVerticesDirty(); } } /// <summary> + /// Lock start value. + /// |固定起始值,不让改变。 + /// </summary> + public bool startLock + { + get { return m_StartLock; } + set { if (PropertyUtil.SetStruct(ref m_StartLock, value)) SetVerticesDirty(); } + } + /// <summary> + /// Lock end value. + /// |固定结束值,不让改变。 + /// </summary> + public bool endLock + { + get { return m_EndLock; } + set { if (PropertyUtil.SetStruct(ref m_EndLock, value)) SetVerticesDirty(); } + } + /// <summary> /// The end percentage of the window out of the data extent, in the range of 0 ~ 100. /// |数据窗口范围的结束百分比。范围是:0 ~ 100。 /// </summary> @@ -375,6 +394,10 @@ namespace XCharts.Runtime get { return m_MarqueeStyle; } set { if (PropertyUtil.SetClass(ref m_MarqueeStyle, value)) SetAllDirty(); } } + /// <summary> + /// start和end变更委托。 + /// </summary> + public CustomDataZoomStartEndFunction startEndFunction { get { return m_StartEndFunction; } set { m_StartEndFunction = value; } } class AxisIndexValueInfo { @@ -631,12 +654,12 @@ namespace XCharts.Runtime internal void UpdateStartLabelPosition(Vector3 pos) { - m_StartLabel.SetPosition(pos); + if (m_StartLabel != null) m_StartLabel.SetPosition(pos); } internal void UpdateEndLabelPosition(Vector3 pos) { - m_EndLabel.SetPosition(pos); + if (m_EndLabel != null) m_EndLabel.SetPosition(pos); } public void UpdateRuntimeData(float chartX, float chartY, float chartWidth, float chartHeight) diff --git a/Runtime/Component/DataZoom/DataZoomHandler.cs b/Runtime/Component/DataZoom/DataZoomHandler.cs index 50f9f755..a98cd540 100644 --- a/Runtime/Component/DataZoom/DataZoomHandler.cs +++ b/Runtime/Component/DataZoom/DataZoomHandler.cs @@ -1,8 +1,10 @@ -using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using XUGL; +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Runtime { @@ -20,7 +22,7 @@ namespace XCharts.Runtime { var dataZoom = component; dataZoom.painter = chart.m_PainterUpper; - dataZoom.refreshComponent = delegate() + dataZoom.refreshComponent = delegate () { var dataZoomObject = ChartHelper.AddObject(s_DefaultDataZoom + dataZoom.index, chart.transform, chart.chartMinAnchor, chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta); @@ -395,9 +397,13 @@ namespace XCharts.Runtime if (end < start) end = start; + if (dataZoom.startEndFunction != null) + dataZoom.startEndFunction(ref start, ref end); - dataZoom.start = start; - dataZoom.end = end; + if (!dataZoom.startLock) + dataZoom.start = start; + if (!dataZoom.endLock) + dataZoom.end = end; if (dataZoom.realtime) { chart.OnDataZoomRangeChanged(dataZoom); @@ -464,8 +470,8 @@ namespace XCharts.Runtime { m_CheckDataZoomLabel = false; var xAxis = chart.GetChartComponent<XAxis>(dataZoom.xAxisIndexs[0]); - var startIndex = (int) ((xAxis.data.Count - 1) * dataZoom.start / 100); - var endIndex = (int) ((xAxis.data.Count - 1) * dataZoom.end / 100); + var startIndex = (int)((xAxis.data.Count - 1) * dataZoom.start / 100); + var endIndex = (int)((xAxis.data.Count - 1) * dataZoom.end / 100); if (m_DataZoomLastStartIndex != startIndex || m_DataZoomLastEndIndex != endIndex) { @@ -530,7 +536,7 @@ namespace XCharts.Runtime var sampleDist = serie.sampleDist < 2 ? 2 : serie.sampleDist; var maxCount = showData.Count; if (sampleDist > 0) - rate = (int) ((maxCount - serie.minShow) / (dataZoom.context.width / sampleDist)); + rate = (int)((maxCount - serie.minShow) / (dataZoom.context.width / sampleDist)); if (rate < 1) rate = 1; @@ -545,7 +551,7 @@ namespace XCharts.Runtime double value = DataHelper.SampleValue(ref showData, serie.sampleType, rate, serie.minShow, maxCount, totalAverage, i, animationDuration, ref dataChanging, axis, unscaledTime); float pX = dataZoom.context.x + i * scaleWid; - float dataHig = (float) ((maxValue - minValue) == 0 ? 0 : + float dataHig = (float)((maxValue - minValue) == 0 ? 0 : (value - minValue) / (maxValue - minValue) * dataZoom.context.height); np = new Vector3(pX, chart.chartY + dataZoom.bottom + dataHig); if (i > 0) @@ -621,7 +627,7 @@ namespace XCharts.Runtime var sampleDist = serie.sampleDist < 2 ? 2 : serie.sampleDist; var maxCount = showData.Count; if (sampleDist > 0) - rate = (int) ((maxCount - serie.minShow) / (dataZoom.context.height / sampleDist)); + rate = (int)((maxCount - serie.minShow) / (dataZoom.context.height / sampleDist)); if (rate < 1) rate = 1; @@ -637,7 +643,7 @@ namespace XCharts.Runtime animationDuration, ref dataChanging, axis, unscaledTime); float pY = dataZoom.context.y + i * scaleWid; float dataHig = (maxValue - minValue) == 0 ? 0 : - (float) ((value - minValue) / (maxValue - minValue) * dataZoom.context.width); + (float)((value - minValue) / (maxValue - minValue) * dataZoom.context.width); np = new Vector3(chart.chartX + chart.chartWidth - dataZoom.right - dataHig, pY); if (i > 0) { diff --git a/Runtime/Component/Label/LabelLine.cs b/Runtime/Component/Label/LabelLine.cs index 87ae5854..3f48c53f 100644 --- a/Runtime/Component/Label/LabelLine.cs +++ b/Runtime/Component/Label/LabelLine.cs @@ -7,7 +7,7 @@ namespace XCharts.Runtime /// 标签的引导线 /// </summary> [System.Serializable] - public class LabelLine : ChildComponent, ISerieExtraComponent, ISerieDataComponent + public class LabelLine : ChildComponent, ISerieComponent, ISerieDataComponent { /// <summary> /// 标签视觉引导线类型 diff --git a/Runtime/Component/Label/LabelStyle.cs b/Runtime/Component/Label/LabelStyle.cs index a404945f..762c6c24 100644 --- a/Runtime/Component/Label/LabelStyle.cs +++ b/Runtime/Component/Label/LabelStyle.cs @@ -8,7 +8,7 @@ namespace XCharts.Runtime /// |图形上的文本标签,可用于说明图形的一些数据信息,比如值,名称等。 /// </summary> [System.Serializable] - public class LabelStyle : ChildComponent, ISerieExtraComponent, ISerieDataComponent + public class LabelStyle : ChildComponent, ISerieComponent, ISerieDataComponent { /// <summary> /// The position of label. @@ -74,6 +74,7 @@ namespace XCharts.Runtime [SerializeField] protected bool m_AutoOffset = false; [SerializeField] protected Vector3 m_Offset; [SerializeField] protected float m_Rotate; + [SerializeField][Since("v3.6.0")] protected bool m_AutoRotate = false; [SerializeField] protected float m_Distance; [SerializeField] protected string m_Formatter; [SerializeField] protected string m_NumericFormatter = ""; @@ -155,6 +156,15 @@ namespace XCharts.Runtime set { if (PropertyUtil.SetStruct(ref m_Rotate, value)) SetComponentDirty(); } } /// <summary> + /// auto rotate of label. + /// |是否自动旋转。 + /// </summary> + public bool autoRotate + { + get { return m_AutoRotate; } + set { if (PropertyUtil.SetStruct(ref m_AutoRotate, value)) SetComponentDirty(); } + } + /// <summary> /// 距离轴线的距离。 /// </summary> public float distance @@ -336,33 +346,38 @@ namespace XCharts.Runtime public virtual string GetFormatterContent(int labelIndex, double value, double minValue, double maxValue, bool isLog = false) { + var newNumericFormatter = numericFormatter; + if (string.IsNullOrEmpty(newNumericFormatter) && !isLog) + { + newNumericFormatter = MathUtil.IsInteger(maxValue) ? "0" : "f" + MathUtil.GetPrecision(maxValue); + } if (string.IsNullOrEmpty(m_Formatter)) { if (isLog) { - return GetFormatterFunctionContent(labelIndex, value, ChartCached.NumberToStr(value, numericFormatter)); + return GetFormatterFunctionContent(labelIndex, value, ChartCached.NumberToStr(value, newNumericFormatter)); } if (minValue >= -1 && minValue <= 1 && maxValue >= -1 && maxValue <= 1) { - int minAcc = ChartHelper.GetFloatAccuracy(minValue); - int maxAcc = ChartHelper.GetFloatAccuracy(maxValue); - int curAcc = ChartHelper.GetFloatAccuracy(value); + int minAcc = MathUtil.GetPrecision(minValue); + int maxAcc = MathUtil.GetPrecision(maxValue); + int curAcc = MathUtil.GetPrecision(value); int acc = Mathf.Max(Mathf.Max(minAcc, maxAcc), curAcc); - return GetFormatterFunctionContent(labelIndex, value, ChartCached.FloatToStr(value, numericFormatter, acc)); + return GetFormatterFunctionContent(labelIndex, value, ChartCached.FloatToStr(value, newNumericFormatter, acc)); } - return GetFormatterFunctionContent(labelIndex, value, ChartCached.NumberToStr(value, numericFormatter)); + return GetFormatterFunctionContent(labelIndex, value, ChartCached.NumberToStr(value, newNumericFormatter)); } else { var content = m_Formatter; - FormatterHelper.ReplaceAxisLabelContent(ref content, numericFormatter, value); + FormatterHelper.ReplaceAxisLabelContent(ref content, newNumericFormatter, value); return GetFormatterFunctionContent(labelIndex, value, content); } } public string GetFormatterDateTime(int labelIndex, double value, double minValue, double maxValue) { - var timestamp = (int) value; + var timestamp = (int)value; var dateTime = DateTimeUtil.GetDateTime(timestamp); var dateString = string.Empty; if (string.IsNullOrEmpty(numericFormatter) || numericFormatter.Equals("f2")) diff --git a/Runtime/Component/Label/SerieLabelHelper.cs b/Runtime/Component/Label/SerieLabelHelper.cs index 84b9b67e..5d9c5a65 100644 --- a/Runtime/Component/Label/SerieLabelHelper.cs +++ b/Runtime/Component/Label/SerieLabelHelper.cs @@ -217,7 +217,9 @@ namespace XCharts.Runtime { var currAngle = serieData.context.halfAngle; var offset = labelLine.lineLength2 + serieData.labelObject.GetTextWidth() / 2; - if ((currAngle - serie.context.startAngle) % 360 > 180) + var angle = (currAngle - serie.context.startAngle) % 360; + var isLeft = angle > 180 || (angle == 0 && serieData.context.startAngle > 0); + if (isLeft) return serieData.context.labelPosition + new Vector3(-offset, 0, 0); else return serieData.context.labelPosition + new Vector3(offset, 0, 0); diff --git a/Runtime/Component/Legend/Legend.cs b/Runtime/Component/Legend/Legend.cs index 9b8e53b4..283110fa 100644 --- a/Runtime/Component/Legend/Legend.cs +++ b/Runtime/Component/Legend/Legend.cs @@ -86,6 +86,7 @@ namespace XCharts.Runtime [SerializeField] private List<Color> m_Colors = new List<Color>(); [SerializeField][Since("v3.1.0")] protected ImageStyle m_Background = new ImageStyle() { show = false }; [SerializeField][Since("v3.1.0")] protected Padding m_Padding = new Padding(); + [SerializeField][Since("v3.6.0")] private List<Vector3> m_Positions = new List<Vector3>(); public LegendContext context = new LegendContext(); @@ -257,6 +258,15 @@ namespace XCharts.Runtime set { if (value != null) { m_Colors = value; SetAllDirty(); } } } /// <summary> + /// the custom positions of legend item. + /// |图例标记的自定义位置列表。 + /// </summary> + public List<Vector3> positions + { + get { return m_Positions; } + set { if (value != null) { m_Positions = value; SetAllDirty(); } } + } + /// <summary> /// 图表是否需要刷新(图例组件不需要刷新图表) /// </summary> public override bool vertsDirty { get { return false; } } @@ -428,6 +438,14 @@ namespace XCharts.Runtime return Color.white; } + public Vector3 GetPosition(int index, Vector3 defaultPos) + { + if (index >= 0 && index < m_Positions.Count) + return m_Positions[index]; + else + return defaultPos; + } + /// <summary> /// Callback handling when parameters change. /// |参数变更时的回调处理。 diff --git a/Runtime/Component/Legend/LegendHandler.cs b/Runtime/Component/Legend/LegendHandler.cs index 52951bd8..21f0e81f 100644 --- a/Runtime/Component/Legend/LegendHandler.cs +++ b/Runtime/Component/Legend/LegendHandler.cs @@ -55,6 +55,7 @@ namespace XCharts.Runtime chart.chartMaxAnchor, chart.chartPivot, chart.chartSizeDelta); legend.gameObject = legendObject; legendObject.hideFlags = chart.chartHideFlags; + //ChartHelper.DestoryGameObjectByMatch(legendObject.transform, "_"); SeriesHelper.UpdateSerieNameList(chart, ref chart.m_LegendRealShowName); legend.context.background = ChartHelper.AddIcon("background", legendObject.transform, 0, 0); legend.context.background.transform.SetSiblingIndex(0); @@ -85,13 +86,14 @@ namespace XCharts.Runtime for (int i = 0; i < datas.Count; i++) { if (!SeriesHelper.IsLegalLegendName(datas[i])) continue; - string legendName = GetFormatterContent(legend, i, datas[i]); + string legendName = datas[i]; + var legendContent = GetFormatterContent(legend, i, datas[i]); var readIndex = chart.m_LegendRealShowName.IndexOf(datas[i]); var active = chart.IsActiveByLegend(datas[i]); var bgColor = LegendHelper.GetIconColor(chart, legend, readIndex, datas[i], active); bgColor.a = legend.itemOpacity; var item = LegendHelper.AddLegendItem(chart, legend, i, datas[i], legendObject.transform, chart.theme, - legendName, bgColor, active, readIndex); + legendContent, bgColor, active, readIndex); legend.SetButton(legendName, item, totalLegend); ChartHelper.ClearEventListener(item.button.gameObject); ChartHelper.AddEventListener(item.button.gameObject, EventTriggerType.PointerDown, (data) => @@ -154,7 +156,7 @@ namespace XCharts.Runtime var content = legend.formatter.Replace("{name}", category); content = content.Replace("{value}", category); var serie = chart.GetSerie(0); - FormatterHelper.ReplaceContent(ref content, dataIndex, legend.numericFormatter, serie, chart); + FormatterHelper.ReplaceContent(ref content, dataIndex, legend.numericFormatter, serie, chart, category); return content; } } diff --git a/Runtime/Component/Legend/LegendHelper.cs b/Runtime/Component/Legend/LegendHelper.cs index 9151d94d..352c8a78 100644 --- a/Runtime/Component/Legend/LegendHelper.cs +++ b/Runtime/Component/Legend/LegendHelper.cs @@ -50,11 +50,11 @@ namespace XCharts.Runtime var objPivot = new Vector2(0, 1); var btnObj = ChartHelper.AddObject(objName, parent, objAnchorMin, objAnchorMax, objPivot, sizeDelta); var iconObj = ChartHelper.AddObject("icon", btnObj.transform, anchorMin, anchorMax, pivot, iconSizeDelta); - var img = ChartHelper.GetOrAddComponent<Image>(btnObj); + var img = ChartHelper.EnsureComponent<Image>(btnObj); img.color = Color.clear; img.raycastTarget = true; - ChartHelper.GetOrAddComponent<Button>(btnObj); - ChartHelper.GetOrAddComponent<Image>(iconObj); + ChartHelper.EnsureComponent<Button>(btnObj); + ChartHelper.EnsureComponent<Image>(iconObj); var label = ChartHelper.AddChartLabel("content", btnObj.transform, legend.labelStyle, theme.legend, content, contentColor, TextAnchor.MiddleLeft); @@ -156,6 +156,7 @@ namespace XCharts.Runtime var currHeight = 0f; var offsetX = 0f; var row = 0; + var index = 0; foreach (var kv in legend.context.buttonList) { var item = kv.Value; @@ -165,7 +166,7 @@ namespace XCharts.Runtime offsetX += legend.context.eachWidthDict[row]; row++; } - item.SetPosition(new Vector3(startX + offsetX, startY - currHeight)); + item.SetPosition(legend.GetPosition(index++, new Vector3(startX + offsetX, startY - currHeight))); currHeight += item.height + legend.itemGap; } } @@ -173,6 +174,7 @@ namespace XCharts.Runtime { var currWidth = 0f; var offsetY = 0f; + var index = 0; foreach (var kv in legend.context.buttonList) { var item = kv.Value; @@ -181,7 +183,7 @@ namespace XCharts.Runtime currWidth = 0; offsetY += legend.context.eachHeight; } - item.SetPosition(new Vector3(startX + currWidth, startY - offsetY)); + item.SetPosition(legend.GetPosition(index++, new Vector3(startX + currWidth, startY - offsetY))); currWidth += item.width + legend.itemGap; } } diff --git a/Runtime/Component/State/BlurStyle.cs b/Runtime/Component/State/BlurStyle.cs index 75c0de29..8f67f5e9 100644 --- a/Runtime/Component/State/BlurStyle.cs +++ b/Runtime/Component/State/BlurStyle.cs @@ -8,6 +8,6 @@ namespace XCharts.Runtime /// </summary> [System.Serializable] [Since("v3.2.0")] - public class BlurStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent + public class BlurStyle : StateStyle, ISerieComponent, ISerieDataComponent { } } \ No newline at end of file diff --git a/Runtime/Component/State/EmphasisStyle.cs b/Runtime/Component/State/EmphasisStyle.cs index e3602d20..9719ae47 100644 --- a/Runtime/Component/State/EmphasisStyle.cs +++ b/Runtime/Component/State/EmphasisStyle.cs @@ -8,7 +8,7 @@ namespace XCharts.Runtime /// </summary> [System.Serializable] [Since("v3.2.0")] - public class EmphasisStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent + public class EmphasisStyle : StateStyle, ISerieComponent, ISerieDataComponent { /// <summary> /// focus type. diff --git a/Runtime/Component/State/SelectStyle.cs b/Runtime/Component/State/SelectStyle.cs index 093274ac..7357a216 100644 --- a/Runtime/Component/State/SelectStyle.cs +++ b/Runtime/Component/State/SelectStyle.cs @@ -8,6 +8,6 @@ namespace XCharts.Runtime /// </summary> [System.Serializable] [Since("v3.2.0")] - public class SelectStyle : StateStyle, ISerieExtraComponent, ISerieDataComponent + public class SelectStyle : StateStyle, ISerieComponent, ISerieDataComponent { } } \ No newline at end of file diff --git a/Runtime/Component/Title/TitleStyle.cs b/Runtime/Component/Title/TitleStyle.cs index 2befc2da..647eb517 100644 --- a/Runtime/Component/Title/TitleStyle.cs +++ b/Runtime/Component/Title/TitleStyle.cs @@ -8,7 +8,7 @@ namespace XCharts.Runtime /// |标题相关设置。 /// </summary> [Serializable] - public class TitleStyle : LabelStyle, ISerieDataComponent, ISerieExtraComponent + public class TitleStyle : LabelStyle, ISerieDataComponent, ISerieComponent { } diff --git a/Runtime/Component/Tooltip/Tooltip.cs b/Runtime/Component/Tooltip/Tooltip.cs index 08a0b423..9a823d71 100644 --- a/Runtime/Component/Tooltip/Tooltip.cs +++ b/Runtime/Component/Tooltip/Tooltip.cs @@ -184,6 +184,7 @@ namespace XCharts.Runtime /// {c}为当前所指示或index为0的serie的y维(dimesion为1)的数值。<br/> /// {d}为当前所指示或index为0的serie的y维(dimesion为1)百分比值,注意不带%号。<br/> /// {e}为当前所指示或index为0的serie的数据项serieData的name。<br/> + /// {h}为当前所指示或index为0的serie的数据项serieData的十六进制颜色值。<br/> /// {f}为数据总和。<br/> /// {g}为数据总个数。<br/> /// {.1}表示指定index为1的serie对应颜色的圆点。<br/> @@ -224,6 +225,7 @@ namespace XCharts.Runtime /// {e}为当前所指示的serie或数据项的数据项serieData的name。<br/> /// {f}为当前所指示的serie的默认维度的数据总和。<br/> /// {g}为当前所指示的serie的数据总个数。<br/> + /// {h}为当前所指示的serie的十六进制颜色值。<br/> /// {c0}表示当前数据项维度为0的数据。<br/> /// {c1}表示当前数据项维度为1的数据。<br/> /// {d3}表示维度3的数据的百分比。它的分母是默认维度(一般是1维度)数据。<br/> diff --git a/Runtime/Component/Tooltip/TooltipView.cs b/Runtime/Component/Tooltip/TooltipView.cs index 3e47f94d..ba2d84bc 100644 --- a/Runtime/Component/Tooltip/TooltipView.cs +++ b/Runtime/Component/Tooltip/TooltipView.cs @@ -217,19 +217,19 @@ namespace XCharts.Runtime view.gameObject.transform.localPosition = Vector3.zero; view.transform = view.gameObject.transform; - view.background = ChartHelper.GetOrAddComponent<Image>(view.gameObject); + view.background = ChartHelper.EnsureComponent<Image>(view.gameObject); view.background.sprite = tooltip.backgroundImage; view.background.type = tooltip.backgroundType; view.background.color = ChartHelper.IsClearColor(tooltip.backgroundColor) ? Color.white : tooltip.backgroundColor; - view.border = ChartHelper.GetOrAddComponent<Outline>(view.gameObject); + view.border = ChartHelper.EnsureComponent<Outline>(view.gameObject); view.border.enabled = tooltip.borderWidth > 0; view.border.useGraphicAlpha = false; view.border.effectColor = tooltip.borderColor; view.border.effectDistance = new Vector2(tooltip.borderWidth, -tooltip.borderWidth); - view.layout = ChartHelper.GetOrAddComponent<VerticalLayoutGroup>(view.gameObject); + view.layout = ChartHelper.EnsureComponent<VerticalLayoutGroup>(view.gameObject); view.layout.childControlHeight = false; view.layout.childControlWidth = false; view.layout.childForceExpandHeight = false; diff --git a/Runtime/Component/VisualMap/VisualMapHandler.cs b/Runtime/Component/VisualMap/VisualMapHandler.cs index a6f672da..32089ea6 100644 --- a/Runtime/Component/VisualMap/VisualMapHandler.cs +++ b/Runtime/Component/VisualMap/VisualMapHandler.cs @@ -3,7 +3,9 @@ using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using XUGL; - +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Runtime { [UnityEngine.Scripting.Preserve] diff --git a/Runtime/Helper/FormatterHelper.cs b/Runtime/Helper/FormatterHelper.cs index 02ddaea8..5874c618 100644 --- a/Runtime/Helper/FormatterHelper.cs +++ b/Runtime/Helper/FormatterHelper.cs @@ -8,7 +8,7 @@ namespace XCharts.Runtime public static class FormatterHelper { public const string PH_NN = "\n"; - private static Regex s_Regex = new Regex(@"{([a-g|.]\d*)(:\d+(-\d+)?)?(:[c-g|x|p|r]\d*|:0\.#*)?}", RegexOptions.IgnoreCase); + private static Regex s_Regex = new Regex(@"{([a-h|.]\d*)(:\d+(-\d+)?)?(:[c-g|x|p|r]\d*|:0\.#*)?}", RegexOptions.IgnoreCase); private static Regex s_RegexSub = new Regex(@"(0\.#*)|(\d+-\d+)|(\w+)|(\.)", RegexOptions.IgnoreCase); private static Regex s_RegexN = new Regex(@"^\d+", RegexOptions.IgnoreCase); private static Regex s_RegexN_N = new Regex(@"\d+-\d+", RegexOptions.IgnoreCase); @@ -16,8 +16,8 @@ namespace XCharts.Runtime private static Regex s_RegexNewLine = new Regex(@"[\\|/]+n|</br>|<br>|<br/>", RegexOptions.IgnoreCase); private static Regex s_RegexForAxisLabel = new Regex(@"{value(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase); private static Regex s_RegexSubForAxisLabel = new Regex(@"(value)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase); - private static Regex s_RegexForSerieLabel = new Regex(@"{[a-g|\.]\d*(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase); - private static Regex s_RegexSubForSerieLabel = new Regex(@"(\.)|([a-g]\d*)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase); + private static Regex s_RegexForSerieLabel = new Regex(@"{[a-h|\.]\d*(:[c-g|x|p|r]\d*)?}", RegexOptions.IgnoreCase); + private static Regex s_RegexSubForSerieLabel = new Regex(@"(\.)|([a-h]\d*)|([c-g|x|p|r]\d*)", RegexOptions.IgnoreCase); public static bool NeedFormat(string content) { @@ -25,7 +25,7 @@ namespace XCharts.Runtime } /// <summary> - /// 替换字符串中的通配符,支持的通配符有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}。 + /// 替换字符串中的通配符,支持的通配符有{.}、{a}、{b}、{c}、{d}、{e}、{f}、{g}、{h}。 /// </summary> /// <param name="content">要替换的字符串</param> /// <param name="dataIndex">选中的数据项serieData索引</param> @@ -34,10 +34,9 @@ namespace XCharts.Runtime /// <param name="series">所有serie</param> /// <param name="theme">用来获取指定index的颜色</param> /// <param name="category">选中的类目,一般用在折线图和柱状图</param> - /// <param name="dataZoom">dataZoom</param> /// <returns></returns> public static bool ReplaceContent(ref string content, int dataIndex, string numericFormatter, Serie serie, - BaseChart chart, DataZoom dataZoom = null) + BaseChart chart, string colorName = null) { var foundDot = false; var mc = s_Regex.Matches(content); @@ -64,16 +63,26 @@ namespace XCharts.Runtime targetIndex = 0; } if (serie == null) continue; - if (p == '.') + if (p == '.' || p == 'h' || p == 'H') { - var bIndex = targetIndex; + var bIndex = dataIndex; if (argsCount >= 2) { var args1Str = args[1].ToString(); if (s_RegexN.IsMatch(args1Str)) bIndex = int.Parse(args1Str); } - content = content.Replace(old, ChartCached.ColorToDotStr(chart.theme.GetColor(bIndex))); - foundDot = true; + var color = string.IsNullOrEmpty(colorName) ? + (Color)chart.GetMarkColor(serie, serie.GetSerieData(bIndex)) : + SeriesHelper.GetNameColor(chart, bIndex, colorName); + if (p == '.') + { + content = content.Replace(old, ChartCached.ColorToDotStr(color)); + foundDot = true; + } + else + { + content = content.Replace(old, "#" + ChartCached.ColorToStr(color)); + } } else if (p == 'a' || p == 'A') { @@ -90,15 +99,15 @@ namespace XCharts.Runtime var args1Str = args[1].ToString(); if (s_RegexN.IsMatch(args1Str)) bIndex = int.Parse(args1Str); } - var needCategory = (p != 'e' && p != 'E') && (serie is Line || serie is Bar); + var needCategory = (p != 'e' && p != 'E') && serie.defaultColorBy != SerieColorBy.Data; if (needCategory) { - var category = chart.GetTooltipCategory(dataIndex, serie, dataZoom); + var category = chart.GetTooltipCategory(dataIndex, serie); content = content.Replace(old, category); } else { - var serieData = serie.GetSerieData(bIndex, dataZoom); + var serieData = serie.GetSerieData(bIndex); content = content.Replace(old, serieData.name); } } @@ -144,7 +153,7 @@ namespace XCharts.Runtime { numericFormatter = SerieHelper.GetNumericFormatter(serie, serie.GetSerieData(bIndex), ""); } - var value = serie.GetData(bIndex, dimensionIndex, dataZoom); + var value = serie.GetData(bIndex, dimensionIndex); if (isPercent) { var total = serie.GetDataTotal(dimensionIndex, serie.GetSerieData(bIndex)); @@ -225,6 +234,10 @@ namespace XCharts.Runtime { content = content.Replace(old, ChartCached.NumberToStr(dataCount, numericFormatter)); } + else if (p == 'h' || p == 'H') + { + content = content.Replace(old, "#" + ChartCached.ColorToStr(color)); + } } content = TrimAndReplaceLine(content); } diff --git a/Runtime/Internal/Attributes/SerieExtraComponentAttribute.cs b/Runtime/Internal/Attributes/SerieComponentAttribute.cs similarity index 63% rename from Runtime/Internal/Attributes/SerieExtraComponentAttribute.cs rename to Runtime/Internal/Attributes/SerieComponentAttribute.cs index f4cb9cea..13de0284 100644 --- a/Runtime/Internal/Attributes/SerieExtraComponentAttribute.cs +++ b/Runtime/Internal/Attributes/SerieComponentAttribute.cs @@ -3,36 +3,40 @@ using System.Collections.Generic; namespace XCharts.Runtime { + /// <summary> + /// The attribute for serie component. + /// |可添加到Serie的组件。 + /// </summary> [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] - public sealed class SerieExtraComponentAttribute : Attribute + public sealed class SerieComponentAttribute : Attribute { public readonly List<Type> types = new List<Type>(); - public SerieExtraComponentAttribute() + public SerieComponentAttribute() { } - public SerieExtraComponentAttribute(Type type1) + public SerieComponentAttribute(Type type1) { AddType(type1); } - public SerieExtraComponentAttribute(Type type1, Type type2) + public SerieComponentAttribute(Type type1, Type type2) { AddType(type1); AddType(type2); } - public SerieExtraComponentAttribute(Type type1, Type type2, Type type3) + public SerieComponentAttribute(Type type1, Type type2, Type type3) { AddType(type1); AddType(type2); AddType(type3); } - public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4) + public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4) { AddType(type1); AddType(type2); AddType(type3); AddType(type4); } - public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5) + public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5) { AddType(type1); AddType(type2); @@ -40,7 +44,7 @@ namespace XCharts.Runtime AddType(type4); AddType(type5); } - public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6) + public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6) { AddType(type1); AddType(type2); @@ -49,7 +53,7 @@ namespace XCharts.Runtime AddType(type5); AddType(type6); } - public SerieExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7) + public SerieComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7) { AddType(type1); AddType(type2); @@ -67,7 +71,7 @@ namespace XCharts.Runtime types.Add(type); } - public bool Contains<T>() where T : ISerieExtraComponent + public bool Contains<T>() where T : ISerieComponent { return Contains(typeof(T)); } diff --git a/Runtime/Internal/Attributes/SerieExtraComponentAttribute.cs.meta b/Runtime/Internal/Attributes/SerieComponentAttribute.cs.meta similarity index 100% rename from Runtime/Internal/Attributes/SerieExtraComponentAttribute.cs.meta rename to Runtime/Internal/Attributes/SerieComponentAttribute.cs.meta diff --git a/Runtime/Internal/Attributes/SerieConvertAttribute.cs b/Runtime/Internal/Attributes/SerieConvertAttribute.cs index 15861197..6e888f96 100644 --- a/Runtime/Internal/Attributes/SerieConvertAttribute.cs +++ b/Runtime/Internal/Attributes/SerieConvertAttribute.cs @@ -2,10 +2,11 @@ using System; namespace XCharts.Runtime { - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] /// <summary> - /// What serie can convert to me + /// The attribute for which serie types can be converted to. + /// |可转化为哪些Serie类型。 /// </summary> + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public sealed class SerieConvertAttribute : Attribute { public readonly Type type0; diff --git a/Runtime/Internal/Attributes/SerieDataExtraComponentAttribute.cs b/Runtime/Internal/Attributes/SerieDataComponentAttribute.cs similarity index 61% rename from Runtime/Internal/Attributes/SerieDataExtraComponentAttribute.cs rename to Runtime/Internal/Attributes/SerieDataComponentAttribute.cs index cd163795..a5b82cbb 100644 --- a/Runtime/Internal/Attributes/SerieDataExtraComponentAttribute.cs +++ b/Runtime/Internal/Attributes/SerieDataComponentAttribute.cs @@ -3,36 +3,41 @@ using System.Collections.Generic; namespace XCharts.Runtime { + /// <summary> + /// The attribute for serie data component. + /// |可添加到SerieData的组件。 + /// </summary> [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] - public sealed class SerieDataExtraComponentAttribute : Attribute + public sealed class SerieDataComponentAttribute : Attribute { public readonly List<Type> types = new List<Type>(); - public SerieDataExtraComponentAttribute() - { } - public SerieDataExtraComponentAttribute(Type type1) + public SerieDataComponentAttribute() + { + } + public SerieDataComponentAttribute(Type type1) { AddType(type1); } - public SerieDataExtraComponentAttribute(Type type1, Type type2) + public SerieDataComponentAttribute(Type type1, Type type2) { AddType(type1); AddType(type2); } - public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3) + public SerieDataComponentAttribute(Type type1, Type type2, Type type3) { AddType(type1); AddType(type2); AddType(type3); } - public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4) + public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4) { AddType(type1); AddType(type2); AddType(type3); AddType(type4); } - public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5) + public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5) { AddType(type1); AddType(type2); @@ -40,7 +45,7 @@ namespace XCharts.Runtime AddType(type4); AddType(type5); } - public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6) + public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6) { AddType(type1); AddType(type2); @@ -49,7 +54,7 @@ namespace XCharts.Runtime AddType(type5); AddType(type6); } - public SerieDataExtraComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7) + public SerieDataComponentAttribute(Type type1, Type type2, Type type3, Type type4, Type type5, Type type6, Type type7) { AddType(type1); AddType(type2); @@ -67,7 +72,7 @@ namespace XCharts.Runtime types.Add(type); } - public bool Contains<T>() where T : ISerieExtraComponent + public bool Contains<T>() where T : ISerieComponent { return Contains(typeof(T)); } diff --git a/Runtime/Internal/Attributes/SerieDataExtraComponentAttribute.cs.meta b/Runtime/Internal/Attributes/SerieDataComponentAttribute.cs.meta similarity index 100% rename from Runtime/Internal/Attributes/SerieDataExtraComponentAttribute.cs.meta rename to Runtime/Internal/Attributes/SerieDataComponentAttribute.cs.meta diff --git a/Runtime/Internal/BaseChart.API.cs b/Runtime/Internal/BaseChart.API.cs index 84847cca..fb8cf4d0 100644 --- a/Runtime/Internal/BaseChart.API.cs +++ b/Runtime/Internal/BaseChart.API.cs @@ -69,7 +69,15 @@ namespace XCharts.Runtime /// </summary> public Vector3 chartPosition { get { return m_ChartPosition; } } public Rect chartRect { get { return m_ChartRect; } } + /// <summary> + /// The callback function of chart init. + /// |图表的初始化完成回调。 + /// </summary> public Action onInit { set { m_OnInit = value; } } + /// <summary> + /// The callback function of chart update. + /// |图表的Update回调。 + /// </summary> public Action onUpdate { set { m_OnUpdate = value; } } /// <summary> /// 自定义绘制回调。在绘制Serie前调用。 @@ -96,21 +104,48 @@ namespace XCharts.Runtime /// </summary> public CustomDrawGaugePointerFunction customDrawGaugePointerFunction { set { m_CustomDrawGaugePointerFunction = value; } get { return m_CustomDrawGaugePointerFunction; } } /// <summary> + /// the callback function of pointer click serie. + /// |鼠标点击Serie回调。 + /// </summary> + [Since("v3.6.0")] + public Action<SerieEventData> onSerieClick { set { m_OnSerieClick = value; m_ForceOpenRaycastTarget = true; } get { return m_OnSerieClick; } } + /// <summary> + /// the callback function of pointer down serie. + /// |鼠标按下Serie回调。 + /// </summary> + [Since("v3.6.0")] + public Action<SerieEventData> onSerieDown { set { m_OnSerieDown = value; m_ForceOpenRaycastTarget = true; } get { return m_OnSerieDown; } } + /// <summary> + /// the callback function of pointer enter serie. + /// |鼠标进入Serie回调。 + /// </summary> + [Since("v3.6.0")] + public Action<SerieEventData> onSerieEnter { set { m_OnSerieEnter = value; m_ForceOpenRaycastTarget = true; } get { return m_OnSerieEnter; } } + /// <summary> + /// the callback function of pointer exit serie. + /// |鼠标离开Serie回调。 + /// </summary> + [Since("v3.6.0")] + public Action<SerieEventData> onSerieExit { set { m_OnSerieExit = value; m_ForceOpenRaycastTarget = true; } get { return m_OnSerieExit; } } + /// <summary> /// the callback function of pointer click pie area. /// |点击饼图区域回调。参数:PointerEventData,SerieIndex,SerieDataIndex /// </summary> - public Action<PointerEventData, int, int> onPointerClickPie { set { m_OnPointerClickPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickPie; } } + [Obsolete("Use \"onSerieClick\" instead", true)] + public Action<PointerEventData, int, int> onPointerClickPie { get; set; } /// <summary> /// the callback function of pointer enter pie area. /// |鼠标进入和离开饼图区域回调,SerieDataIndex为-1时表示离开。参数:PointerEventData,SerieIndex,SerieDataIndex /// </summary> [Since("v3.3.0")] + [Obsolete("Use \"onSerieEnter\" instead", true)] public Action<int, int> onPointerEnterPie { set { m_OnPointerEnterPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerEnterPie; } } /// <summary> /// the callback function of click bar. /// |点击柱形图柱条回调。参数:eventData, dataIndex /// </summary> - public Action<PointerEventData, int> onPointerClickBar { set { m_OnPointerClickBar = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerClickBar; } } + [Obsolete("Use \"onSerieClick\" instead", true)] + public Action<PointerEventData, int> onPointerClickBar { get; set; } /// <summary> /// 坐标轴变更数据索引时回调。参数:axis, dataIndex/dataValue /// </summary> @@ -464,7 +499,7 @@ namespace XCharts.Runtime /// 转换X轴和Y轴的配置 /// </summary> /// <param name="index">坐标轴索引,0或1</param> - public void CovertXYAxis(int index) + public void ConvertXYAxis(int index) { List<MainComponent> m_XAxes; List<MainComponent> m_YAxes; @@ -601,13 +636,14 @@ namespace XCharts.Runtime /// <returns></returns> public Color32 GetMarkColor(Serie serie, SerieData serieData) { - if (ChartHelper.IsClearColor(serie.markColor)) + var itemStyle = SerieHelper.GetItemStyle(serie, serieData); + if (ChartHelper.IsClearColor(itemStyle.markColor)) { return GetItemColor(serie, serieData); } else { - return serie.markColor; + return itemStyle.markColor; } } @@ -631,15 +667,5 @@ namespace XCharts.Runtime SerieHelper.GetItemColor(out color, out toColor, serie, null, m_Theme); return color; } - - /// <summary> - /// 保存图表为图片。 - /// </summary> - /// <param name="imageType">type of image: png, jpg, exr</param> - /// <param name="savePath">save path</param> - public void SaveAsImage(string imageType = "png", string savePath = "") - { - StartCoroutine(SaveAsImageSync(imageType, savePath)); - } } } \ No newline at end of file diff --git a/Runtime/Internal/BaseChart.Component.cs b/Runtime/Internal/BaseChart.Component.cs index b989f2d9..dd57e897 100644 --- a/Runtime/Internal/BaseChart.Component.cs +++ b/Runtime/Internal/BaseChart.Component.cs @@ -41,7 +41,7 @@ namespace XCharts.Runtime public T AddChartComponent<T>() where T : MainComponent { - return (T) AddChartComponent(typeof(T)); + return (T)AddChartComponent(typeof(T)); } public T AddChartComponentWhenNoExist<T>() where T : MainComponent @@ -118,7 +118,7 @@ namespace XCharts.Runtime if (attrubte.handler == null) return; - var handler = (MainComponentHandler) Activator.CreateInstance(attrubte.handler); + var handler = (MainComponentHandler)Activator.CreateInstance(attrubte.handler); handler.attribute = attrubte; handler.chart = this; handler.SetComponent(component); @@ -221,9 +221,9 @@ namespace XCharts.Runtime return GetChartComponentNum(typeof(T)); } + private static List<MainComponent> list; public int GetChartComponentNum(Type type) { - List<MainComponent> list; if (m_ComponentMaps.TryGetValue(type, out list)) return list.Count; else @@ -245,6 +245,7 @@ namespace XCharts.Runtime return m_ComponentMaps[typeof(T)]; } + [Obsolete("'GetOrAddChartComponent' is obsolete, Use 'EnsureChartComponent' instead.")] public T GetOrAddChartComponent<T>() where T : MainComponent { var component = GetChartComponent<T>(); @@ -254,6 +255,23 @@ namespace XCharts.Runtime return component; } + /// <summary> + /// Ensure the chart has the component, if not, add it. + /// Note: it may fail to add. + /// |确保图表有该组件,如果没有则添加。注意:有可能添加不成功。 + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns>component, or null if add failed.</returns> + [Since("v3.6.0")] + public T EnsureChartComponent<T>() where T : MainComponent + { + var component = GetChartComponent<T>(); + if (component == null) + return AddChartComponent<T>(); + else + return component; + } + public bool TryGetChartComponent<T>(out T component, int index = 0) where T : MainComponent { @@ -262,7 +280,7 @@ namespace XCharts.Runtime { if (com is T && com.index == index) { - component = (T) com; + component = (T)com; return true; } } @@ -417,11 +435,11 @@ namespace XCharts.Runtime var yAxis = GetChartComponent<YAxis>(); if (yAxis.IsCategory()) { - return yAxis.GetData((int) yAxis.context.pointerValue, dataZoom); + return yAxis.GetData((int)yAxis.context.pointerValue, dataZoom); } else if (xAxis.IsCategory()) { - return xAxis.GetData((int) xAxis.context.pointerValue, dataZoom); + return xAxis.GetData((int)xAxis.context.pointerValue, dataZoom); } return null; } @@ -431,11 +449,11 @@ namespace XCharts.Runtime var yAxis = GetChartComponent<YAxis>(serie.yAxisIndex); if (yAxis.IsCategory()) { - return yAxis.GetData((int) yAxis.context.pointerValue, dataZoom); + return yAxis.GetData((int)yAxis.context.pointerValue, dataZoom); } else if (xAxis.IsCategory()) { - return xAxis.GetData((int) xAxis.context.pointerValue, dataZoom); + return xAxis.GetData((int)xAxis.context.pointerValue, dataZoom); } return null; } diff --git a/Runtime/Internal/BaseChart.Serie.cs b/Runtime/Internal/BaseChart.Serie.cs index 99ec7bc4..282e5da5 100644 --- a/Runtime/Internal/BaseChart.Serie.cs +++ b/Runtime/Internal/BaseChart.Serie.cs @@ -179,23 +179,23 @@ namespace XCharts.Runtime RefreshChart(); } - public bool CovertSerie<T>(Serie serie) where T : Serie + public bool ConvertSerie<T>(Serie serie) where T : Serie { - return CovertSerie(serie, typeof(T)); + return ConvertSerie(serie, typeof(T)); } - public bool CovertSerie(Serie serie, Type type) + public bool ConvertSerie(Serie serie, Type type) { try { - var newSerie = type.InvokeMember("CovertSerie", + var newSerie = type.InvokeMember("ConvertSerie", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public, null, null, new object[] { serie }) as Serie; return ReplaceSerie(serie, newSerie); } catch { - Debug.LogError(string.Format("CovertSerie Failed: can't found {0}.CovertSerie(Serie serie)", type.Name)); + Debug.LogError(string.Format("ConvertSerie Failed: can't found {0}.ConvertSerie(Serie serie)", type.Name)); return false; } } @@ -647,6 +647,7 @@ namespace XCharts.Runtime public void SetSerieActive(Serie serie, bool active) { serie.show = active; + serie.RefreshLabel(); serie.AnimationReset(); if (active) serie.AnimationFadeIn(); UpdateLegendColor(serie.serieName, active); diff --git a/Runtime/Internal/BaseChart.cs b/Runtime/Internal/BaseChart.cs index 7f1afd17..46b3d4f9 100644 --- a/Runtime/Internal/BaseChart.cs +++ b/Runtime/Internal/BaseChart.cs @@ -11,13 +11,14 @@ namespace XCharts.Runtime { [AddComponentMenu("XCharts/EmptyChart", 10)] [ExecuteInEditMode] - [RequireComponent(typeof(RectTransform))] + [RequireComponent(typeof(RectTransform),typeof(CanvasRenderer))] [DisallowMultipleComponent] public partial class BaseChart : BaseGraph, ISerializationCallbackReceiver { [SerializeField] protected string m_ChartName; [SerializeField] protected ThemeStyle m_Theme = new ThemeStyle(); [SerializeField] protected Settings m_Settings; + [SerializeField] protected DebugInfo m_DebugInfo = new DebugInfo(); #pragma warning disable 0414 [SerializeField][ListForComponent(typeof(AngleAxis))] private List<AngleAxis> m_AngleAxes = new List<AngleAxis>(); @@ -67,6 +68,8 @@ namespace XCharts.Runtime public List<MainComponent> components { get { return m_Components; } } public List<Serie> series { get { return m_Series; } } + public DebugInfo debug { get { return m_DebugInfo; } } + public override HideFlags chartHideFlags { get { return m_DebugInfo.showAllChartObject ? HideFlags.None : HideFlags.HideInHierarchy; } } protected float m_ChartWidth; protected float m_ChartHeight; @@ -86,9 +89,11 @@ namespace XCharts.Runtime protected Action<VertexHelper> m_OnDrawTop; protected Action<VertexHelper, Serie> m_OnDrawSerieBefore; protected Action<VertexHelper, Serie> m_OnDrawSerieAfter; - protected Action<PointerEventData, int, int> m_OnPointerClickPie; + protected Action<SerieEventData> m_OnSerieClick; + protected Action<SerieEventData> m_OnSerieDown; + protected Action<SerieEventData> m_OnSerieEnter; + protected Action<SerieEventData> m_OnSerieExit; protected Action<int, int> m_OnPointerEnterPie; - protected Action<PointerEventData, int> m_OnPointerClickBar; protected Action<Axis, double> m_OnAxisPointerValueChanged; protected Action<Legend, int, string, bool> m_OnLegendClick; protected Action<Legend, int, string> m_OnLegendEnter; @@ -743,11 +748,5 @@ namespace XCharts.Runtime InitComponentHandlers(); InitSerieHandlers(); } - - private IEnumerator SaveAsImageSync(string imageType, string path) - { - yield return new WaitForEndOfFrame(); - ChartHelper.SaveAsImage(rectTransform, canvas, imageType, path); - } } } \ No newline at end of file diff --git a/Runtime/Internal/BaseGraph.API.cs b/Runtime/Internal/BaseGraph.API.cs index f2c9c945..499c24b1 100644 --- a/Runtime/Internal/BaseGraph.API.cs +++ b/Runtime/Internal/BaseGraph.API.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using UnityEngine; using UnityEngine.EventSystems; @@ -36,6 +37,11 @@ namespace XCharts.Runtime /// </summary> public Vector3 graphPosition { get { return m_GraphPosition; } } public Rect graphRect { get { return m_GraphRect; } } + public Vector2 graphSizeDelta { get { return m_GraphSizeDelta; } } + public Vector2 graphPivot { get { return m_GraphPivot; } } + public Vector2 graphMinAnchor { get { return m_GraphMinAnchor; } } + public Vector2 graphMaxAnchor { get { return m_GraphMaxAnchor; } } + public Vector2 graphAnchoredPosition { get { return m_GraphAnchoredPosition; } } /// <summary> /// The postion of pointer. /// |鼠标位置。 @@ -45,7 +51,8 @@ namespace XCharts.Runtime /// Whether the mouse pointer is in the chart. /// |鼠标是否在图表内。 /// </summary> - public bool isPointerInChart { get; protected set; } + public bool isPointerInChart + { get { return m_PointerEventData != null; } } /// <summary> /// 警告信息。 /// </summary> @@ -165,5 +172,21 @@ namespace XCharts.Runtime } return true; } + + /// <summary> + /// 保存图表为图片。 + /// </summary> + /// <param name="imageType">type of image: png, jpg, exr</param> + /// <param name="savePath">save path</param> + public void SaveAsImage(string imageType = "png", string savePath = "") + { + StartCoroutine(SaveAsImageSync(imageType, savePath)); + } + + private IEnumerator SaveAsImageSync(string imageType, string path) + { + yield return new WaitForEndOfFrame(); + ChartHelper.SaveAsImage(rectTransform, canvas, imageType, path); + } } } \ No newline at end of file diff --git a/Runtime/Internal/BaseGraph.cs b/Runtime/Internal/BaseGraph.cs index f5e52e10..8e1a8bca 100644 --- a/Runtime/Internal/BaseGraph.cs +++ b/Runtime/Internal/BaseGraph.cs @@ -1,7 +1,10 @@ -using System; +using System; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; +#if INPUT_SYSTEM_ENABLED +using Input = XCharts.Runtime.InputHelper; +#endif namespace XCharts.Runtime { @@ -9,310 +12,305 @@ namespace XCharts.Runtime public partial class BaseGraph : MaskableGraphic, IPointerDownHandler, IPointerUpHandler, IPointerEnterHandler, IPointerExitHandler, IBeginDragHandler, IPointerClickHandler, IDragHandler, IEndDragHandler, IScrollHandler + { + [SerializeField] protected bool m_EnableTextMeshPro = false; + + protected Painter m_Painter; + protected int m_SiblingIndex; + + protected float m_GraphWidth; + protected float m_GraphHeight; + protected float m_GraphX; + protected float m_GraphY; + protected Vector3 m_GraphPosition = Vector3.zero; + protected Vector2 m_GraphMinAnchor; + protected Vector2 m_GraphMaxAnchor; + protected Vector2 m_GraphPivot; + protected Vector2 m_GraphSizeDelta; + protected Vector2 m_GraphAnchoredPosition; + protected Rect m_GraphRect = new Rect(0, 0, 0, 0); + protected bool m_RefreshChart = false; + protected bool m_ForceOpenRaycastTarget; + protected bool m_IsControlledByLayout = false; + protected bool m_PainerDirty = false; + protected bool m_IsOnValidate = false; + protected Vector3 m_LastLocalPosition; + protected PointerEventData m_PointerEventData; + + protected Action<PointerEventData, BaseGraph> m_OnPointerClick; + protected Action<PointerEventData, BaseGraph> m_OnPointerDown; + protected Action<PointerEventData, BaseGraph> m_OnPointerUp; + protected Action<PointerEventData, BaseGraph> m_OnPointerEnter; + protected Action<PointerEventData, BaseGraph> m_OnPointerExit; + protected Action<PointerEventData, BaseGraph> m_OnBeginDrag; + protected Action<PointerEventData, BaseGraph> m_OnDrag; + protected Action<PointerEventData, BaseGraph> m_OnEndDrag; + protected Action<PointerEventData, BaseGraph> m_OnScroll; + + public virtual HideFlags chartHideFlags { get { return HideFlags.None; } } + + private ScrollRect m_ScrollRect; + + public Painter painter { get { return m_Painter; } } + + protected virtual void InitComponent() { + InitPainter(); + } - [SerializeField] protected bool m_EnableTextMeshPro = false; - [SerializeField] protected DebugInfo m_DebugInfo = new DebugInfo(); + protected override void Awake() + { + CheckTextMeshPro(); + m_SiblingIndex = 0; + m_LastLocalPosition = transform.localPosition; + UpdateSize(); + InitComponent(); + CheckIsInScrollRect(); + } - protected Painter m_Painter; - protected int m_SiblingIndex; + protected override void Start() + { + m_RefreshChart = true; + } - protected float m_GraphWidth; - protected float m_GraphHeight; - protected float m_GraphX; - protected float m_GraphY; - protected Vector3 m_GraphPosition = Vector3.zero; - protected Vector2 m_GraphMinAnchor; - protected Vector2 m_GraphMaxAnchor; - protected Vector2 m_GraphPivot; - protected Vector2 m_GraphSizeDelta; - protected Vector2 m_GraphAnchoredPosition; - protected Rect m_GraphRect = new Rect(0, 0, 0, 0); - protected bool m_RefreshChart = false; - protected bool m_ForceOpenRaycastTarget; - protected bool m_IsControlledByLayout = false; - protected bool m_PainerDirty = false; - protected bool m_IsOnValidate = false; - protected Vector3 m_LastLocalPosition; - - protected Action<PointerEventData, BaseGraph> m_OnPointerClick; - protected Action<PointerEventData, BaseGraph> m_OnPointerDown; - protected Action<PointerEventData, BaseGraph> m_OnPointerUp; - protected Action<PointerEventData, BaseGraph> m_OnPointerEnter; - protected Action<PointerEventData, BaseGraph> m_OnPointerExit; - protected Action<PointerEventData, BaseGraph> m_OnBeginDrag; - protected Action<PointerEventData, BaseGraph> m_OnDrag; - protected Action<PointerEventData, BaseGraph> m_OnEndDrag; - protected Action<PointerEventData, BaseGraph> m_OnScroll; - - protected Vector2 graphAnchorMax { get { return m_GraphMinAnchor; } } - protected Vector2 graphAnchorMin { get { return m_GraphMaxAnchor; } } - protected Vector2 graphPivot { get { return m_GraphPivot; } } - public HideFlags chartHideFlags { get { return m_DebugInfo.showAllChartObject ? HideFlags.None : HideFlags.HideInHierarchy; } } - public DebugInfo debug { get { return m_DebugInfo; } } - private ScrollRect m_ScrollRect; - - public Painter painter { get { return m_Painter; } } - - protected virtual void InitComponent() - { - InitPainter(); - } - - protected override void Awake() + protected virtual void Update() + { + CheckSize(); + if (m_IsOnValidate) { + m_IsOnValidate = false; CheckTextMeshPro(); - m_SiblingIndex = 0; - m_LastLocalPosition = transform.localPosition; - UpdateSize(); InitComponent(); - CheckIsInScrollRect(); + RefreshGraph(); } - - protected override void Start() + else { - m_RefreshChart = true; + CheckComponent(); } + CheckPointerPos(); + CheckRefreshChart(); + CheckRefreshPainter(); + } - protected virtual void Update() - { - CheckSize(); - if (m_IsOnValidate) - { - m_IsOnValidate = false; - CheckTextMeshPro(); - InitComponent(); - RefreshGraph(); - } - else - { - CheckComponent(); - } - CheckPointerPos(); - CheckRefreshChart(); - CheckRefreshPainter(); - } - - protected virtual void SetAllComponentDirty() - { + protected virtual void SetAllComponentDirty() + { #if UNITY_EDITOR - if (!Application.isPlaying) - { - m_IsOnValidate = true; - } -#endif - m_PainerDirty = true; - } - - protected virtual void CheckComponent() - { - if (m_PainerDirty) - { - InitPainter(); - m_PainerDirty = false; - } - } - - private void CheckTextMeshPro() - { -#if dUI_TextMeshPro - var enableTextMeshPro = true; -#else - var enableTextMeshPro = false; -#endif - if (m_EnableTextMeshPro != enableTextMeshPro) - { - m_EnableTextMeshPro = enableTextMeshPro; - RebuildChartObject(); - } - } - -#if UNITY_EDITOR - protected override void Reset() - { } - - protected override void OnValidate() + if (!Application.isPlaying) { m_IsOnValidate = true; } #endif + m_PainerDirty = true; + } - protected override void OnDestroy() + protected virtual void CheckComponent() + { + if (m_PainerDirty) { - for (int i = transform.childCount - 1; i >= 0; i--) - { - DestroyImmediate(transform.GetChild(i).gameObject); - } - } - - protected override void OnPopulateMesh(VertexHelper vh) - { - vh.Clear(); - } - - protected virtual void InitPainter() - { - m_Painter = ChartHelper.AddPainterObject("painter_b", transform, m_GraphMinAnchor, - m_GraphMaxAnchor, m_GraphPivot, new Vector2(m_GraphWidth, m_GraphHeight), chartHideFlags, 1); - m_Painter.type = Painter.Type.Base; - m_Painter.onPopulateMesh = OnDrawPainterBase; - m_Painter.transform.SetSiblingIndex(0); - } - - private void CheckSize() - { - var currWidth = rectTransform.rect.width; - var currHeight = rectTransform.rect.height; - - if (m_GraphWidth == 0 && m_GraphHeight == 0 && (currWidth != 0 || currHeight != 0)) - { - Awake(); - } - - if (m_GraphWidth != currWidth || - m_GraphHeight != currHeight || - m_GraphMinAnchor != rectTransform.anchorMin || - m_GraphMaxAnchor != rectTransform.anchorMax || - m_GraphAnchoredPosition != rectTransform.anchoredPosition) - { - UpdateSize(); - } - if (!ChartHelper.IsValueEqualsVector3(m_LastLocalPosition, transform.localPosition)) - { - m_LastLocalPosition = transform.localPosition; - OnLocalPositionChanged(); - } - } - - protected void UpdateSize() - { - m_GraphWidth = rectTransform.rect.width; - m_GraphHeight = rectTransform.rect.height; - - m_GraphMaxAnchor = rectTransform.anchorMax; - m_GraphMinAnchor = rectTransform.anchorMin; - m_GraphSizeDelta = rectTransform.sizeDelta; - m_GraphAnchoredPosition = rectTransform.anchoredPosition; - - rectTransform.pivot = LayerHelper.ResetChartPositionAndPivot(m_GraphMinAnchor, m_GraphMaxAnchor, - m_GraphWidth, m_GraphHeight, ref m_GraphX, ref m_GraphY); - m_GraphPivot = rectTransform.pivot; - - m_GraphRect.x = m_GraphX; - m_GraphRect.y = m_GraphY; - m_GraphRect.width = m_GraphWidth; - m_GraphRect.height = m_GraphHeight; - m_GraphPosition.x = m_GraphX; - m_GraphPosition.y = m_GraphY; - - OnSizeChanged(); - } - - private void CheckPointerPos() - { - if (!isPointerInChart) return; - if (canvas == null) return; - Vector2 local; - if (!ScreenPointToChartPoint(Input.mousePosition, out local)) - { - pointerPos = Vector2.zero; - } - else - { - pointerPos = local; - } - } - - protected virtual void CheckIsInScrollRect() - { - m_ScrollRect = GetComponentInParent<ScrollRect>(); - } - - protected virtual void CheckRefreshChart() - { - if (m_RefreshChart) - { - m_Painter.Refresh(); - m_RefreshChart = false; - } - } - - protected virtual void CheckRefreshPainter() - { - m_Painter.CheckRefresh(); - } - - internal virtual void RefreshPainter(Painter painter) - { - if (painter == null) return; - painter.Refresh(); - } - - protected virtual void OnSizeChanged() - { - m_RefreshChart = true; - } - - protected virtual void OnLocalPositionChanged() - { } - - protected virtual void OnDrawPainterBase(VertexHelper vh, Painter painter) - { - DrawPainterBase(vh); - } - - protected virtual void DrawPainterBase(VertexHelper vh) - { } - - public virtual void OnPointerClick(PointerEventData eventData) - { - if (m_OnPointerClick != null) m_OnPointerClick(eventData, this); - } - - public virtual void OnPointerDown(PointerEventData eventData) - { - if (m_OnPointerDown != null) m_OnPointerDown(eventData, this); - } - - public virtual void OnPointerUp(PointerEventData eventData) - { - if (m_OnPointerUp != null) m_OnPointerUp(eventData, this); - } - - public virtual void OnPointerEnter(PointerEventData eventData) - { - isPointerInChart = true; - if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this); - } - - public virtual void OnPointerExit(PointerEventData eventData) - { - isPointerInChart = false; - if (m_OnPointerExit != null) m_OnPointerExit(eventData, this); - } - - public virtual void OnBeginDrag(PointerEventData eventData) - { - if (m_ScrollRect != null) m_ScrollRect.OnBeginDrag(eventData); - if (m_OnBeginDrag != null) m_OnBeginDrag(eventData, this); - } - - public virtual void OnEndDrag(PointerEventData eventData) - { - if (m_ScrollRect != null) m_ScrollRect.OnEndDrag(eventData); - if (m_OnEndDrag != null) m_OnEndDrag(eventData, this); - } - - public virtual void OnDrag(PointerEventData eventData) - { - if (m_ScrollRect != null) m_ScrollRect.OnDrag(eventData); - if (m_OnDrag != null) m_OnDrag(eventData, this); - } - - public virtual void OnScroll(PointerEventData eventData) - { - if (m_ScrollRect != null) m_ScrollRect.OnScroll(eventData); - if (m_OnScroll != null) m_OnScroll(eventData, this); + InitPainter(); + m_PainerDirty = false; } } + + private void CheckTextMeshPro() + { +#if dUI_TextMeshPro + var enableTextMeshPro = true; +#else + var enableTextMeshPro = false; +#endif + if (m_EnableTextMeshPro != enableTextMeshPro) + { + m_EnableTextMeshPro = enableTextMeshPro; + RebuildChartObject(); + } + } + +#if UNITY_EDITOR + protected override void Reset() { } + + protected override void OnValidate() + { + m_IsOnValidate = true; + } +#endif + + protected override void OnDestroy() + { + for (int i = transform.childCount - 1; i >= 0; i--) + { + DestroyImmediate(transform.GetChild(i).gameObject); + } + } + + protected override void OnPopulateMesh(VertexHelper vh) + { + vh.Clear(); + } + + protected virtual void InitPainter() + { + m_Painter = ChartHelper.AddPainterObject("painter_b", transform, m_GraphMinAnchor, + m_GraphMaxAnchor, m_GraphPivot, new Vector2(m_GraphWidth, m_GraphHeight), chartHideFlags, 1); + m_Painter.type = Painter.Type.Base; + m_Painter.onPopulateMesh = OnDrawPainterBase; + m_Painter.transform.SetSiblingIndex(0); + } + + private void CheckSize() + { + var currWidth = rectTransform.rect.width; + var currHeight = rectTransform.rect.height; + + if (m_GraphWidth == 0 && m_GraphHeight == 0 && (currWidth != 0 || currHeight != 0)) + { + Awake(); + } + + if (m_GraphWidth != currWidth || + m_GraphHeight != currHeight || + m_GraphMinAnchor != rectTransform.anchorMin || + m_GraphMaxAnchor != rectTransform.anchorMax || + m_GraphAnchoredPosition != rectTransform.anchoredPosition) + { + UpdateSize(); + } + if (!ChartHelper.IsValueEqualsVector3(m_LastLocalPosition, transform.localPosition)) + { + m_LastLocalPosition = transform.localPosition; + OnLocalPositionChanged(); + } + } + + protected void UpdateSize() + { + m_GraphWidth = rectTransform.rect.width; + m_GraphHeight = rectTransform.rect.height; + + m_GraphMaxAnchor = rectTransform.anchorMax; + m_GraphMinAnchor = rectTransform.anchorMin; + m_GraphSizeDelta = rectTransform.sizeDelta; + m_GraphAnchoredPosition = rectTransform.anchoredPosition; + + rectTransform.pivot = LayerHelper.ResetChartPositionAndPivot(m_GraphMinAnchor, m_GraphMaxAnchor, + m_GraphWidth, m_GraphHeight, ref m_GraphX, ref m_GraphY); + m_GraphPivot = rectTransform.pivot; + + m_GraphRect.x = m_GraphX; + m_GraphRect.y = m_GraphY; + m_GraphRect.width = m_GraphWidth; + m_GraphRect.height = m_GraphHeight; + m_GraphPosition.x = m_GraphX; + m_GraphPosition.y = m_GraphY; + + OnSizeChanged(); + } + + private void CheckPointerPos() + { + if (!isPointerInChart) return; + if (canvas == null) return; + Vector2 mousePos = m_PointerEventData.position; + Vector2 local; + if (!ScreenPointToChartPoint(mousePos, out local)) + { + pointerPos = Vector2.zero; + } + else + { + pointerPos = local; + } + } + + protected virtual void CheckIsInScrollRect() + { + m_ScrollRect = GetComponentInParent<ScrollRect>(); + } + + protected virtual void CheckRefreshChart() + { + if (m_RefreshChart && m_Painter != null) + { + m_Painter.Refresh(); + m_RefreshChart = false; + } + } + + protected virtual void CheckRefreshPainter() + { + if (m_Painter == null) return; + m_Painter.CheckRefresh(); + } + + internal virtual void RefreshPainter(Painter painter) + { + if (painter == null) return; + painter.Refresh(); + } + + protected virtual void OnSizeChanged() + { + m_RefreshChart = true; + } + + protected virtual void OnLocalPositionChanged() { } + + protected virtual void OnDrawPainterBase(VertexHelper vh, Painter painter) + { + DrawPainterBase(vh); + } + + protected virtual void DrawPainterBase(VertexHelper vh) { } + + public virtual void OnPointerClick(PointerEventData eventData) + { + if (m_OnPointerClick != null) m_OnPointerClick(eventData, this); + } + + public virtual void OnPointerDown(PointerEventData eventData) + { + if (m_OnPointerDown != null) m_OnPointerDown(eventData, this); + } + + public virtual void OnPointerUp(PointerEventData eventData) + { + if (m_OnPointerUp != null) m_OnPointerUp(eventData, this); + } + + public virtual void OnPointerEnter(PointerEventData eventData) + { + m_PointerEventData = eventData; + if (m_OnPointerEnter != null) m_OnPointerEnter(eventData, this); + } + + public virtual void OnPointerExit(PointerEventData eventData) + { + m_PointerEventData = null; + if (m_OnPointerExit != null) m_OnPointerExit(eventData, this); + } + + public virtual void OnBeginDrag(PointerEventData eventData) + { + if (m_ScrollRect != null) m_ScrollRect.OnBeginDrag(eventData); + if (m_OnBeginDrag != null) m_OnBeginDrag(eventData, this); + } + + public virtual void OnEndDrag(PointerEventData eventData) + { + if (m_ScrollRect != null) m_ScrollRect.OnEndDrag(eventData); + if (m_OnEndDrag != null) m_OnEndDrag(eventData, this); + } + + public virtual void OnDrag(PointerEventData eventData) + { + if (m_ScrollRect != null) m_ScrollRect.OnDrag(eventData); + if (m_OnDrag != null) m_OnDrag(eventData, this); + } + + public virtual void OnScroll(PointerEventData eventData) + { + if (m_ScrollRect != null) m_ScrollRect.OnScroll(eventData); + if (m_OnScroll != null) m_OnScroll(eventData, this); + } + } } \ No newline at end of file diff --git a/Runtime/Internal/Misc/DelegateFunction.cs b/Runtime/Internal/Misc/DelegateFunction.cs index 224616bd..15b1e9db 100644 --- a/Runtime/Internal/Misc/DelegateFunction.cs +++ b/Runtime/Internal/Misc/DelegateFunction.cs @@ -22,4 +22,10 @@ namespace XCharts.Runtime /// <returns></returns> public delegate float SymbolSizeFunction(List<double> data); public delegate void CustomDrawGaugePointerFunction(VertexHelper vh, int serieIndex, int dataIndex, float currentAngle); + /// <summary> + /// DataZoom的start和end变更时的委托方法。 + /// </summary> + /// <param name="start"></param> + /// <param name="end"></param> + public delegate void CustomDataZoomStartEndFunction(ref float start, ref float end); } \ No newline at end of file diff --git a/Runtime/Internal/Misc/ISerieComponent.cs b/Runtime/Internal/Misc/ISerieComponent.cs new file mode 100644 index 00000000..9a863d4d --- /dev/null +++ b/Runtime/Internal/Misc/ISerieComponent.cs @@ -0,0 +1,11 @@ +namespace XCharts.Runtime +{ + /// <summary> + /// The interface for serie component. + /// |可用于Serie的组件。 + /// </summary> + public interface ISerieComponent + { + bool show { get; set; } + } +} \ No newline at end of file diff --git a/Runtime/Internal/Misc/ISerieExtraComponent.cs.meta b/Runtime/Internal/Misc/ISerieComponent.cs.meta similarity index 100% rename from Runtime/Internal/Misc/ISerieExtraComponent.cs.meta rename to Runtime/Internal/Misc/ISerieComponent.cs.meta diff --git a/Runtime/Internal/Misc/ISerieContainer.cs b/Runtime/Internal/Misc/ISerieContainer.cs index 5e09dc4c..53300a57 100644 --- a/Runtime/Internal/Misc/ISerieContainer.cs +++ b/Runtime/Internal/Misc/ISerieContainer.cs @@ -2,7 +2,6 @@ namespace XCharts.Runtime { public interface ISerieContainer { - //bool runtimeIsPointerEnter { get; } int index { get; } bool IsPointerEnter(); } diff --git a/Runtime/Internal/Misc/ISerieDataComponent.cs b/Runtime/Internal/Misc/ISerieDataComponent.cs index 0187300c..278c5903 100644 --- a/Runtime/Internal/Misc/ISerieDataComponent.cs +++ b/Runtime/Internal/Misc/ISerieDataComponent.cs @@ -1,9 +1,10 @@ -using UnityEngine; -using UnityEngine.EventSystems; -using UnityEngine.UI; - namespace XCharts.Runtime { + /// <summary> + /// The interface for serie data component. + /// |可用于SerieData的组件。 + /// </summary> public interface ISerieDataComponent - { } + { + } } \ No newline at end of file diff --git a/Runtime/Internal/Misc/ISerieExtraComponent.cs b/Runtime/Internal/Misc/ISerieExtraComponent.cs deleted file mode 100644 index dda88d4c..00000000 --- a/Runtime/Internal/Misc/ISerieExtraComponent.cs +++ /dev/null @@ -1,11 +0,0 @@ -using UnityEngine; -using UnityEngine.EventSystems; -using UnityEngine.UI; - -namespace XCharts.Runtime -{ - public interface ISerieExtraComponent - { - bool show { get; set; } - } -} \ No newline at end of file diff --git a/Runtime/Internal/Misc/SerieEventData.cs b/Runtime/Internal/Misc/SerieEventData.cs new file mode 100644 index 00000000..4d3ff773 --- /dev/null +++ b/Runtime/Internal/Misc/SerieEventData.cs @@ -0,0 +1,46 @@ +using UnityEngine; + +namespace XCharts.Runtime +{ + /// <summary> + /// the data of serie event. + /// |serie事件的数据。 + /// </summary> + public class SerieEventData + { + /// <summary> + /// the position of pointer in chart. + /// |鼠标在chart中的位置。 + /// </summary> + public Vector3 pointerPos { get; set; } + /// <summary> + /// the index of serie in chart.series. + /// |在chart.series中的索引。 + /// </summary> + public int serieIndex { get; set; } + /// <summary> + /// the index of data in serie.data. + /// |在serie.data中的索引。 + /// </summary> + public int dataIndex { get; set; } + /// <summary> + /// the dimension of data. + /// |数据的维度。 + /// </summary> + public int dimension { get; set; } + /// <summary> + /// the value of data. + /// |数据的值。 + /// </summary> + public double value { get; set; } + + public void Reset() + { + serieIndex = -1; + dataIndex = -1; + dimension = -1; + value = 0; + pointerPos = Vector3.zero; + } + } +} \ No newline at end of file diff --git a/Runtime/Internal/Misc/SerieEventData.cs.meta b/Runtime/Internal/Misc/SerieEventData.cs.meta new file mode 100644 index 00000000..8d23ec0c --- /dev/null +++ b/Runtime/Internal/Misc/SerieEventData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fdfaa773d93294d78b2fb4b8f42708a3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Internal/Object/ChartLabel.cs b/Runtime/Internal/Object/ChartLabel.cs index 746e17fb..89ff9ee3 100644 --- a/Runtime/Internal/Object/ChartLabel.cs +++ b/Runtime/Internal/Object/ChartLabel.cs @@ -21,6 +21,7 @@ namespace XCharts.Runtime private Vector3 m_IconOffest; private Align m_Align = Align.Left; private Image m_IconImage; + private bool m_Active = true; public Image icon { @@ -40,6 +41,7 @@ namespace XCharts.Runtime public bool hideIconIfTextEmpty { set { m_HideIconIfTextEmpty = value; } } public bool isIconActive { get; private set; } public bool isAnimationEnd { get; internal set; } + public Rect rect { get; set; } internal RectTransform objectRect { @@ -167,6 +169,11 @@ namespace XCharts.Runtime if (m_LabelText != null) m_LabelText.SetColor(color); } + public void SetRotate(float rotate) + { + transform.localEulerAngles = new Vector3(0, 0, rotate); + } + public void SetTextRotate(float rotate) { if (m_LabelText != null) m_LabelText.SetLocalEulerAngles(new Vector3(0, 0, rotate)); @@ -187,14 +194,22 @@ namespace XCharts.Runtime return transform.localPosition; } + public override bool IsActive() + { + return m_Active; + } + public void SetActive(bool flag) { + m_Active = flag; ChartHelper.SetActive(gameObject, flag); } + public void SetTextActive(bool flag) { if (m_LabelText != null) m_LabelText.SetActive(flag); } + public void SetIconActive(bool flag) { isIconActive = flag; diff --git a/Runtime/Internal/Painter.cs b/Runtime/Internal/Painter.cs index c60041a9..e0c33fea 100644 --- a/Runtime/Internal/Painter.cs +++ b/Runtime/Internal/Painter.cs @@ -23,7 +23,7 @@ namespace XCharts.Runtime public Type type { get { return m_Type; } set { m_Type = value; } } public void Refresh() { - if (gameObject == null) return; + if (null == this || gameObject == null) return; if (!gameObject.activeSelf) return; m_Refresh = true; } @@ -51,7 +51,7 @@ namespace XCharts.Runtime Init(); } - internal void CheckRefresh() + public void CheckRefresh() { if (m_Refresh && gameObject.activeSelf) { diff --git a/Runtime/Internal/Pools/SerieEventDataPool.cs b/Runtime/Internal/Pools/SerieEventDataPool.cs new file mode 100644 index 00000000..899d51f0 --- /dev/null +++ b/Runtime/Internal/Pools/SerieEventDataPool.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace XCharts.Runtime +{ + public static class SerieEventDataPool + { + private static readonly ObjectPool<SerieEventData> s_ListPool = new ObjectPool<SerieEventData>(null, OnClear); + + static void OnGet(SerieEventData data) + { + } + + static void OnClear(SerieEventData data) + { + data.Reset(); + } + + public static SerieEventData Get(Vector3 pos, int serieIndex, int dataIndex, int dimension, double value) + { + var data = s_ListPool.Get(); + data.serieIndex = serieIndex; + data.dataIndex = dataIndex; + data.pointerPos = pos; + data.dimension = dimension; + return data; + } + + public static void Release(SerieEventData toRelease) + { + s_ListPool.Release(toRelease); + } + } +} \ No newline at end of file diff --git a/Runtime/Internal/Pools/SerieEventDataPool.cs.meta b/Runtime/Internal/Pools/SerieEventDataPool.cs.meta new file mode 100644 index 00000000..40316cc8 --- /dev/null +++ b/Runtime/Internal/Pools/SerieEventDataPool.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 30d123dd5c38446f18183f50336322bb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Internal/UIComponent.cs b/Runtime/Internal/UIComponent.cs new file mode 100644 index 00000000..8a1266e6 --- /dev/null +++ b/Runtime/Internal/UIComponent.cs @@ -0,0 +1,92 @@ +using System; +using UnityEngine; +using UnityEngine.UI; + +namespace XCharts.Runtime +{ + /// <summary> + /// UI组件基类。 + /// </summary> + [ExecuteInEditMode] + [RequireComponent(typeof(RectTransform))] + [DisallowMultipleComponent] + public class UIComponent : BaseGraph + { + [SerializeField] private bool m_DebugModel = false; + [SerializeField] protected UIComponentTheme m_Theme = new UIComponentTheme(); + [SerializeField] private ImageStyle m_Background = new ImageStyle() { show = false }; + protected bool m_DataDirty; + public override HideFlags chartHideFlags { get { return m_DebugModel ? HideFlags.None : HideFlags.HideInHierarchy; } } + public UIComponentTheme theme { get { return m_Theme; } set { m_Theme = value; } } + /// <summary> + /// 背景样式。 + /// </summary> + public ImageStyle background { get { return m_Background; } set { m_Background = value; color = Color.white; } } + /// <summary> + /// Update chart theme. + /// |切换内置主题。 + /// </summary> + /// <param name="theme">theme</param> + public bool UpdateTheme(ThemeType theme) + { + if (theme == ThemeType.Custom) + { + Debug.LogError("UpdateTheme: not support switch to Custom theme."); + return false; + } + if (m_Theme.sharedTheme == null) + m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default); + m_Theme.sharedTheme.CopyTheme(theme); + m_Theme.SetAllDirty(); + return true; + } + + protected override void InitComponent() + { + base.InitComponent(); + if (m_Theme.sharedTheme == null) + m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default); + UIHelper.InitBackground(this); + } + + protected override void CheckComponent() + { + base.CheckComponent(); + if (m_Theme.anyDirty) + { + if (m_Theme.componentDirty) + { + SetAllComponentDirty(); + } + if (m_Theme.vertsDirty) RefreshGraph(); + m_Theme.ClearDirty(); + } + } + + protected override void SetAllComponentDirty() + { + base.SetAllComponentDirty(); + InitComponent(); + } + + protected override void OnDrawPainterBase(VertexHelper vh, Painter painter) + { + vh.Clear(); + UIHelper.DrawBackground(vh, this); + } + + protected override void Update() + { + base.Update(); + if (m_DataDirty) + { + m_DataDirty = false; + DataDirty(); + } + } + + protected virtual void DataDirty() + { + } + } +} \ No newline at end of file diff --git a/Runtime/Internal/UIComponent.cs.meta b/Runtime/Internal/UIComponent.cs.meta new file mode 100644 index 00000000..9c155b18 --- /dev/null +++ b/Runtime/Internal/UIComponent.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bb30814b19a9d4c1d800ae89e4537a8a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Internal/UIComponentTheme.cs b/Runtime/Internal/UIComponentTheme.cs new file mode 100644 index 00000000..ad51eed3 --- /dev/null +++ b/Runtime/Internal/UIComponentTheme.cs @@ -0,0 +1,53 @@ +using System; +using UnityEngine; +using UnityEngine.UI; + +namespace XCharts.Runtime +{ + [Serializable] + public class UIComponentTheme : ChildComponent + { + [SerializeField] private bool m_Show = true; + [SerializeField] private Theme m_SharedTheme; + [SerializeField] private bool m_TransparentBackground = false; + + public bool show { get { return m_Show; } } + /// <summary> + /// the theme of chart. + /// |主题类型。 + /// </summary> + public ThemeType themeType + { + get { return sharedTheme.themeType; } + } + /// <summary> + /// theme name. + /// |主题名字。 + /// </summary> + public string themeName + { + get { return sharedTheme.themeName; } + } + /// <summary> + /// the asset of theme. + /// |主题配置。 + /// </summary> + public Theme sharedTheme + { + get { return m_SharedTheme; } + set { m_SharedTheme = value; SetAllDirty(); } + } + /// <summary> + /// the background color of chart. + /// |背景颜色。 + /// </summary> + public Color32 backgroundColor + { + get + { + if (m_TransparentBackground) return ColorUtil.clearColor32; + else return sharedTheme.backgroundColor; + } + } + } +} \ No newline at end of file diff --git a/Runtime/Internal/UIComponentTheme.cs.meta b/Runtime/Internal/UIComponentTheme.cs.meta new file mode 100644 index 00000000..c4032b0f --- /dev/null +++ b/Runtime/Internal/UIComponentTheme.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 259f5ef4039524e15a7f88578635e907 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Internal/Utilities/ChartCached.cs b/Runtime/Internal/Utilities/ChartCached.cs index 59a505bd..d376421a 100644 --- a/Runtime/Internal/Utilities/ChartCached.cs +++ b/Runtime/Internal/Utilities/ChartCached.cs @@ -53,10 +53,7 @@ namespace XCharts.Runtime { if (string.IsNullOrEmpty(formatter)) { - if (value - (int) value == 0) - s_NumberToStr[value][formatter] = ((int) value).ToString(); - else - s_NumberToStr[value][formatter] = value.ToString(); + s_NumberToStr[value][formatter] = value.ToString(); } else if (formatter.StartsWith(NUMERIC_FORMATTER_D) || formatter.StartsWith(NUMERIC_FORMATTER_d) || @@ -64,7 +61,7 @@ namespace XCharts.Runtime formatter.StartsWith(NUMERIC_FORMATTER_x) ) { - s_NumberToStr[value][formatter] = ((int) value).ToString(formatter, ci); + s_NumberToStr[value][formatter] = ((int)value).ToString(formatter, ci); } else { diff --git a/Runtime/Internal/Utilities/ChartHelper.cs b/Runtime/Internal/Utilities/ChartHelper.cs index 6d600da7..d98ffa12 100644 --- a/Runtime/Internal/Utilities/ChartHelper.cs +++ b/Runtime/Internal/Utilities/ChartHelper.cs @@ -123,14 +123,14 @@ namespace XCharts.Runtime GameObject.DestroyImmediate(go.gameObject, true); } } - public static void DestoryGameObjectByMatch(Transform parent, string match) + public static void DestoryGameObjectByMatch(Transform parent, string containString) { if (parent == null) return; var childCount = parent.childCount; for (int i = childCount - 1; i >= 0; i--) { var go = parent.GetChild(i); - if (go != null && go.name.StartsWith(match)) + if (go != null && go.name.Contains(containString)) { GameObject.DestroyImmediate(go.gameObject, true); } @@ -161,20 +161,47 @@ namespace XCharts.Runtime { #if UNITY_EDITOR if (!Application.isPlaying) - GameObject.DestroyImmediate(component as GameObject, true); + GameObject.DestroyImmediate(component as UnityEngine.Object); else - GameObject.Destroy(component as GameObject); + GameObject.Destroy(component as UnityEngine.Object); #else - GameObject.Destroy(component as GameObject); + GameObject.Destroy(component as UnityEngine.Object); #endif } } + + [System.Obsolete("Use EnsureComponent instead")] public static T GetOrAddComponent<T>(Transform transform) where T : Component { - return GetOrAddComponent<T>(transform.gameObject); + return EnsureComponent<T>(transform.gameObject); } + [System.Obsolete("Use EnsureComponent instead")] public static T GetOrAddComponent<T>(GameObject gameObject) where T : Component + { + return EnsureComponent<T>(gameObject); + } + + /// <summary> + /// Ensure that the transform has the specified component, add it if not. + /// |确保对象有指定的组件,如果没有则添加。 + /// </summary> + /// <param name="transform"></param> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + public static T EnsureComponent<T>(Transform transform) where T : Component + { + return EnsureComponent<T>(transform.gameObject); + } + + /// <summary> + /// Ensure that the game object has the specified component, add it if not. + /// | 确保对象有指定的组件,如果没有则添加。 + /// </summary> + /// <param name="gameObject"></param> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + public static T EnsureComponent<T>(GameObject gameObject) where T : Component { if (gameObject.GetComponent<T>() == null) { @@ -214,7 +241,7 @@ namespace XCharts.Runtime obj.transform.localRotation = Quaternion.Euler(0, 0, 0); obj.layer = parent.gameObject.layer; } - RectTransform rect = GetOrAddComponent<RectTransform>(obj); + RectTransform rect = EnsureComponent<RectTransform>(obj); rect.localPosition = Vector3.zero; rect.sizeDelta = sizeDelta; rect.anchorMin = anchorMin; @@ -228,7 +255,7 @@ namespace XCharts.Runtime Vector2 anchorMax, Vector2 pivot, Vector2 sizeDelta) { if (obj == null) return; - RectTransform rect = GetOrAddComponent<RectTransform>(obj); + RectTransform rect = EnsureComponent<RectTransform>(obj); rect.sizeDelta = sizeDelta; rect.anchorMin = anchorMin; rect.anchorMax = anchorMax; @@ -253,7 +280,7 @@ namespace XCharts.Runtime chartText.tmpText.raycastTarget = false; chartText.tmpText.enableWordWrapping = textStyle.autoWrap; #else - chartText.text = GetOrAddComponent<Text>(txtObj); + chartText.text = EnsureComponent<Text>(txtObj); chartText.text.font = textStyle.font == null ? theme.font : textStyle.font; chartText.text.fontStyle = textStyle.fontStyle; chartText.text.horizontalOverflow = textStyle.autoWrap ? HorizontalWrapMode.Wrap : HorizontalWrapMode.Overflow; @@ -272,7 +299,7 @@ namespace XCharts.Runtime chartText.SetLineSpacing(textStyle.lineSpacing); chartText.SetActive(textStyle.show); - RectTransform rect = GetOrAddComponent<RectTransform>(txtObj); + RectTransform rect = EnsureComponent<RectTransform>(txtObj); rect.localPosition = Vector3.zero; rect.sizeDelta = sizeDelta; rect.anchorMin = anchorMin; @@ -281,13 +308,13 @@ namespace XCharts.Runtime return chartText; } - internal static Painter AddPainterObject(string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax, + public static Painter AddPainterObject(string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 pivot, Vector2 sizeDelta, HideFlags hideFlags, int siblingIndex) { var painterObj = ChartHelper.AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta); painterObj.hideFlags = hideFlags; painterObj.transform.SetSiblingIndex(siblingIndex); - return ChartHelper.GetOrAddComponent<Painter>(painterObj); + return ChartHelper.EnsureComponent<Painter>(painterObj); } public static Image AddIcon(string name, Transform parent, IconStyle iconStyle) @@ -303,7 +330,7 @@ namespace XCharts.Runtime var pivot = new Vector2(0.5f, 0.5f); var sizeDelta = new Vector2(width, height); GameObject iconObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta); - var img = GetOrAddComponent<Image>(iconObj); + var img = EnsureComponent<Image>(iconObj); if (img.raycastTarget != false) img.raycastTarget = false; if (img.type != type) @@ -324,14 +351,20 @@ namespace XCharts.Runtime if (background == null) return; if (imageStyle.show) { + background.gameObject.SetActive(true); background.sprite = imageStyle.sprite; background.color = imageStyle.color; background.type = imageStyle.type; + if (imageStyle.width > 0 && imageStyle.height > 0) + { + background.rectTransform.sizeDelta = new Vector2(imageStyle.width, imageStyle.height); + } } else { background.sprite = null; background.color = Color.clear; + background.gameObject.SetActive(false); } } @@ -356,7 +389,43 @@ namespace XCharts.Runtime var alignment = textStyle.GetAlignment(autoAlignment); UpdateAnchorAndPivotByTextAlignment(alignment, out anchorMin, out anchorMax, out pivot); var labelObj = AddObject(name, parent, anchorMin, anchorMax, pivot, sizeDelta); - var label = GetOrAddComponent<ChartLabel>(labelObj); + //ChartHelper.RemoveComponent<Text>(labelObj); + var label = EnsureComponent<ChartLabel>(labelObj); + label.text = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, + sizeDelta, textStyle, theme, autoColor, autoAlignment, label.text); + label.icon = ChartHelper.AddIcon("Icon", label.gameObject.transform, labelStyle.icon); + label.SetSize(labelStyle.width, labelStyle.height); + label.SetTextPadding(labelStyle.textPadding); + label.SetText(content); + label.UpdateIcon(labelStyle.icon); + if (labelStyle.background.show) + { + label.color = (!labelStyle.background.autoColor || autoColor == Color.clear) ? + labelStyle.background.color : autoColor; + label.sprite = labelStyle.background.sprite; + label.type = labelStyle.background.type; + } + else + { + label.color = Color.clear; + label.sprite = null; + } + label.transform.localEulerAngles = new Vector3(0, 0, labelStyle.rotate); + label.transform.localPosition = labelStyle.offset; + return label; + } + + public static ChartLabel AddChartLabel2(string name, Transform parent, LabelStyle labelStyle, + ComponentTheme theme, string content, Color autoColor, TextAnchor autoAlignment = TextAnchor.MiddleCenter) + { + Vector2 anchorMin, anchorMax, pivot; + var sizeDelta = new Vector2(labelStyle.width, labelStyle.height); + var textStyle = labelStyle.textStyle; + var alignment = textStyle.GetAlignment(autoAlignment); + UpdateAnchorAndPivotByTextAlignment(alignment, out anchorMin, out anchorMax, out pivot); + var vector0_5 = new Vector2(0.5f, 0.5f); + var labelObj = AddObject(name, parent, vector0_5, vector0_5, vector0_5, sizeDelta); + var label = EnsureComponent<ChartLabel>(labelObj); label.text = AddTextObject("Text", label.gameObject.transform, anchorMin, anchorMax, pivot, sizeDelta, textStyle, theme, autoColor, autoAlignment, label.text); label.icon = ChartHelper.AddIcon("Icon", label.gameObject.transform, labelStyle.icon); @@ -678,7 +747,7 @@ namespace XCharts.Runtime } if (ceilRate == 0) { - var bigger = Math.Floor(Math.Abs(min)); + var bigger = min < 0 ? Math.Ceiling(Math.Abs(min)) : Math.Floor(Math.Abs(min)); int n = 1; while (bigger / (Mathf.Pow(10, n)) > 10) { @@ -741,24 +810,12 @@ namespace XCharts.Runtime return min; } - public static int GetFloatAccuracy(double value) - { - if (value > 1 || value < -1) return 0; - int count = 1; - int intvalue = (int) (value * Mathf.Pow(10, count)); - while (intvalue == 0 && count < 38) - { - count++; - intvalue = (int) (value * Mathf.Pow(10, count)); - } - if (count == 38 && (value == 0 || value == 1)) return 1; - else return count; - } + public static void AddEventListener(GameObject obj, EventTriggerType type, UnityEngine.Events.UnityAction<BaseEventData> call) { - EventTrigger trigger = GetOrAddComponent<EventTrigger>(obj.gameObject); + EventTrigger trigger = EnsureComponent<EventTrigger>(obj.gameObject); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = type; entry.callback = new EventTrigger.TriggerEvent(); diff --git a/Runtime/Internal/Utilities/InputHelper.cs b/Runtime/Internal/Utilities/InputHelper.cs new file mode 100644 index 00000000..94870706 --- /dev/null +++ b/Runtime/Internal/Utilities/InputHelper.cs @@ -0,0 +1,111 @@ +#if INPUT_SYSTEM_ENABLED +using UnityEngine; +using UnityEngine.InputSystem; +using UnityEngine.InputSystem.LowLevel; + +namespace XCharts.Runtime +{ + public class InputHelper + { + public static Vector2 mousePosition + { + get + { + var value = Vector2.zero; + if (null != Mouse.current) + { + value = Mouse.current.position.ReadValue(); + } + else if (null != Touchscreen.current && Touchscreen.current.touches.Count > 0) + { + value = Touchscreen.current.touches[0].position.ReadValue(); + } + return value; + } + } + public static int touchCount + { + get + { + var value = 0; + if (null != Touchscreen.current) + { + value = Touchscreen.current.touches.Count; + } + return value; + } + } + + public static Touch GetTouch(int v) + { + UnityEngine.TouchPhase PhaseConvert(TouchState state) + { + UnityEngine.TouchPhase temp = UnityEngine.TouchPhase.Began; + switch (state.phase) + { + case UnityEngine.InputSystem.TouchPhase.Began: + temp = UnityEngine.TouchPhase.Began; + break; + case UnityEngine.InputSystem.TouchPhase.Moved: + temp = UnityEngine.TouchPhase.Moved; + break; + case UnityEngine.InputSystem.TouchPhase.Canceled: + temp = UnityEngine.TouchPhase.Canceled; + break; + case UnityEngine.InputSystem.TouchPhase.Stationary: + temp = UnityEngine.TouchPhase.Stationary; + break; + default: + case UnityEngine.InputSystem.TouchPhase.Ended: + case UnityEngine.InputSystem.TouchPhase.None: + temp = UnityEngine.TouchPhase.Ended; + break; + } + return temp; + } + var touch = Touchscreen.current.touches[v]; + var value = touch.ReadValue(); + //copy touchcontrol's touchstate data into touch + return new Touch + { + deltaPosition = value.delta, + fingerId = value.touchId, + position = value.position, + phase = PhaseConvert(value), + pressure = value.pressure, + radius = value.radius.magnitude, + radiusVariance = value.radius.sqrMagnitude, + type = value.isPrimaryTouch ? TouchType.Direct : TouchType.Indirect, + tapCount = value.tapCount, + deltaTime = Time.realtimeSinceStartup - (float)value.startTime, + rawPosition = value.startPosition, + }; + } + + public static bool GetKeyDown(KeyCode keyCode) + { + var value = false; + if (null != Keyboard.current) + { + var key = Keyboard.current.spaceKey; + switch (keyCode) + { + case KeyCode.Space: + key = Keyboard.current.spaceKey; + break; + case KeyCode.L: + key = Keyboard.current.lKey; + break; + default: + Debug.LogError($"{nameof(InputHelper)}: not support {keyCode} yet , please add it yourself if needed"); + break; + } + + value = key.wasPressedThisFrame; + } + return value; + } + + } +} +#endif diff --git a/Runtime/Internal/Utilities/InputHelper.cs.meta b/Runtime/Internal/Utilities/InputHelper.cs.meta new file mode 100644 index 00000000..fddfc435 --- /dev/null +++ b/Runtime/Internal/Utilities/InputHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5069defa9fe8c7a43843e1189e2d606c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Internal/Utilities/MathUtil.cs b/Runtime/Internal/Utilities/MathUtil.cs index 2103a5fa..443d3f97 100644 --- a/Runtime/Internal/Utilities/MathUtil.cs +++ b/Runtime/Internal/Utilities/MathUtil.cs @@ -1,10 +1,5 @@ using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; using UnityEngine; -using UnityEngine.EventSystems; -using UnityEngine.UI; namespace XCharts.Runtime { @@ -41,5 +36,23 @@ namespace XCharts.Runtime { return a + (b - a) * Clamp01(t); } + + public static bool IsInteger(double value) + { + return Math.Abs(value % 1) <= (Double.Epsilon * 100); + } + + public static int GetPrecision(double value) + { + if (IsInteger(value)) return 0; + int count = 1; + double intvalue = value * Mathf.Pow(10, count); + while (!IsInteger(intvalue) && count < 38) + { + count++; + intvalue = value * Mathf.Pow(10, count); + } + return count; + } } } \ No newline at end of file diff --git a/Runtime/Internal/Utilities/UIHelper.cs b/Runtime/Internal/Utilities/UIHelper.cs new file mode 100644 index 00000000..a5598f30 --- /dev/null +++ b/Runtime/Internal/Utilities/UIHelper.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; +using XUGL; + +namespace XCharts.Runtime +{ + /// <summary> + /// UI帮助类。 + /// </summary> + public static class UIHelper + { + internal static void DrawBackground(VertexHelper vh, UIComponent component) + { + if (component.background.show == false || + (component.background.sprite == null && ChartHelper.IsClearColor(component.background.color))) + { + var p1 = new Vector3(component.graphX, component.graphY); + var p2 = new Vector3(component.graphX + component.graphWidth, component.graphY); + var p3 = new Vector3(component.graphX + component.graphWidth, component.graphY + component.graphHeight); + var p4 = new Vector3(component.graphX, component.graphY + component.graphHeight); + UGL.DrawQuadrilateral(vh, p1, p2, p3, p4, GetBackgroundColor(component)); + } + } + + internal static void InitBackground(UIComponent table) + { + if (table.background.show == false || + (table.background.sprite == null && ChartHelper.IsClearColor(table.background.color))) + { + ChartHelper.DestoryGameObject(table.transform, "Background"); + return; + } + var sizeDelta = table.background.width > 0 && table.background.height > 0 ? + new Vector2(table.background.width, table.background.height) : + table.graphSizeDelta; + var backgroundObj = ChartHelper.AddObject("Background", table.transform, table.graphMinAnchor, + table.graphMaxAnchor, table.graphPivot, sizeDelta); + backgroundObj.hideFlags = table.chartHideFlags; + + var backgroundImage = ChartHelper.EnsureComponent<Image>(backgroundObj); + ChartHelper.UpdateRectTransform(backgroundObj, table.graphMinAnchor, + table.graphMaxAnchor, table.graphPivot, sizeDelta); + ChartHelper.SetBackground(backgroundImage, table.background); + backgroundObj.transform.SetSiblingIndex(0); + } + + public static Color32 GetBackgroundColor(UIComponent component) + { + if (component.background.show && !ChartHelper.IsClearColor(component.background.color)) + return component.background.color; + else + return component.theme.backgroundColor; + } + } +} \ No newline at end of file diff --git a/Runtime/Internal/Utilities/UIHelper.cs.meta b/Runtime/Internal/Utilities/UIHelper.cs.meta new file mode 100644 index 00000000..029495c6 --- /dev/null +++ b/Runtime/Internal/Utilities/UIHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3be0399ecf6194793aa056e45ebfe20a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Internal/XChartsMgr.cs b/Runtime/Internal/XChartsMgr.cs index 584ce315..661e35b7 100644 --- a/Runtime/Internal/XChartsMgr.cs +++ b/Runtime/Internal/XChartsMgr.cs @@ -2,8 +2,9 @@ using System.Collections.Generic; using System.IO; using UnityEngine; using UnityEngine.SceneManagement; +using System.Linq; #if UNITY_EDITOR -using UnityEditor; +using ADB = UnityEditor.AssetDatabase; #endif namespace XCharts.Runtime @@ -20,8 +21,8 @@ namespace XCharts.Runtime [ExecuteInEditMode] public static class XChartsMgr { - public static readonly string version = "3.5.0"; - public static readonly int versionDate = 20221201; + public static readonly string version = "3.6.0"; + public static readonly int versionDate = 20230401; public static string fullVersion { get { return version + "-" + versionDate; } } internal static List<BaseChart> chartList = new List<BaseChart>(); @@ -78,7 +79,8 @@ namespace XCharts.Runtime public static bool ContainsChart(string chartName) { if (string.IsNullOrEmpty(chartName)) return false; - return GetCharts(chartName) != null; + var list = GetCharts(chartName); + return list != null && list.Count > 0; } public static bool ContainsChart(BaseChart chart) @@ -127,6 +129,7 @@ namespace XCharts.Runtime } #if UNITY_EDITOR + public static string GetPackageFullPath() { string packagePath = Path.GetFullPath("Packages/com.monitor1394.xcharts"); @@ -134,38 +137,13 @@ namespace XCharts.Runtime { return packagePath; } - packagePath = Path.GetFullPath("Assets/.."); - if (Directory.Exists(packagePath)) - { - if (File.Exists(packagePath + "/Assets/Packages/XCharts/package.json")) - { - return packagePath + "/Assets/Packages/XCharts"; - } - - if (File.Exists(packagePath + "/Assets/XCharts/package.json")) - { - return packagePath + "/Assets/XCharts"; - } - - string[] matchingPaths = Directory.GetDirectories(packagePath, "XCharts", SearchOption.AllDirectories); - string path = ValidateLocation(matchingPaths, packagePath); - if (path != null) return Path.Combine(packagePath, path); - } - return null; - } - - private static string ValidateLocation(string[] paths, string projectPath) - { - for (int i = 0; i < paths.Length; i++) - { - if (File.Exists(paths[i] + "/package.json")) - { - string folderPath = paths[i].Replace(projectPath, ""); - folderPath = folderPath.TrimStart('\\', '/'); - return folderPath; - } - } - return null; + packagePath = ADB.FindAssets("t:Script") + .Where(v => Path.GetFileNameWithoutExtension(ADB.GUIDToAssetPath(v)) == "XChartsMgr") + .Select(id => ADB.GUIDToAssetPath(id)) + .FirstOrDefault(); + packagePath = Path.GetDirectoryName(packagePath); + packagePath = packagePath.Substring(0, packagePath.LastIndexOf("Runtime")); + return packagePath; } [UnityEditor.Callbacks.DidReloadScripts] @@ -185,133 +163,6 @@ namespace XCharts.Runtime } } } - - public static void EnableTextMeshPro() - { - DefineSymbolsUtil.AddGlobalDefine("dUI_TextMeshPro"); - RemoveAllChartObject(); - } - - public static void DisableTextMeshPro() - { - DefineSymbolsUtil.RemoveGlobalDefine("dUI_TextMeshPro"); - RemoveAllChartObject(); - } - - public static bool IsExistTMPAssembly() - { - -#if UNITY_2018_1_OR_NEWER - foreach (var assembly in UnityEditor.Compilation.CompilationPipeline.GetAssemblies(UnityEditor.Compilation.AssembliesType.Player)) - { - if (assembly.name.Equals("Unity.TextMeshPro")) return true; - } -#elif UNITY_2017_3_OR_NEWER - foreach (var assembly in UnityEditor.Compilation.CompilationPipeline.GetAssemblies()) - { - if (assembly.name.Equals("Unity.TextMeshPro")) return true; - } -#endif - return false; - } - - public static bool ModifyTMPRefence(bool removeTMP = false) - { - var packagePath = GetPackageFullPath(); - if (!ModifyTMPRefence(packagePath + "/Runtime/XCharts.Runtime.asmdef", removeTMP)) return false; - if (!ModifyTMPRefence(packagePath + "/Editor/XCharts.Editor.asmdef", removeTMP)) return false; - return true; - } - - private static bool ModifyTMPRefence(string asmdefPath, bool removeTMP = false) - { - if (!File.Exists(asmdefPath)) - { - Debug.LogError("AddTMPRefence ERROR: can't find: " + asmdefPath); - return false; - } - try - { - var dest = new List<string>(); - var refs = new List<string>(); - var lines = File.ReadAllLines(asmdefPath); - var referencesStart = false; - var addedTMP = false; - var removedTMP = false; - var tmpName = "\"Unity.TextMeshPro\""; - var refCount = 0; - foreach (var line in lines) - { - if (string.IsNullOrEmpty(line)) continue; - if (line.Contains("\"references\": [")) - { - dest.Add(line); - referencesStart = true; - } - else if (referencesStart) - { - if (line.Contains("],")) - { - referencesStart = false; - if (refCount > 0) - { - var old = dest[dest.Count - 1]; - if (old.EndsWith(",")) - dest[dest.Count - 1] = old.Substring(0, old.Length - 1); - } - if (!removeTMP && !refs.Contains(tmpName)) - { - if (refs.Count > 0) - dest[dest.Count - 1] = dest[dest.Count - 1] + ","; - dest.Add(" " + tmpName); - dest.Add(line); - addedTMP = true; - } - else - { - dest.Add(line); - } - } - else - { - if (removeTMP) - { - if (!line.Contains(tmpName)) - { - dest.Add(line); - refCount++; - } - else - { - removedTMP = true; - } - } - else - { - dest.Add(line); - refs.Add(line.Trim()); - } - } - } - else - { - dest.Add(line); - } - } - if (addedTMP || removedTMP) - { - File.WriteAllText(asmdefPath, string.Join("\n", dest.ToArray())); - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); - } - return true; - } - catch (System.Exception e) - { - Debug.LogError("AddTMPRefence ERROR:" + e.Message); - return false; - } - } #endif } } \ No newline at end of file diff --git a/Runtime/Serie/Bar/Bar.cs b/Runtime/Serie/Bar/Bar.cs index bd3c1031..21066d66 100644 --- a/Runtime/Serie/Bar/Bar.cs +++ b/Runtime/Serie/Bar/Bar.cs @@ -5,8 +5,8 @@ namespace XCharts.Runtime [SerieConvert(typeof(Line), typeof(Pie))] [CoordOptions(typeof(GridCoord), typeof(PolarCoord))] [DefaultAnimation(AnimationType.BottomToTop)] - [SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField("m_Ignore")] public class Bar : Serie, INeedSerieContainer { @@ -23,7 +23,7 @@ namespace XCharts.Runtime return serie; } - public static Bar CovertSerie(Serie serie) + public static Bar ConvertSerie(Serie serie) { var newSerie = SerieHelper.CloneSerie<Bar>(serie); return newSerie; diff --git a/Runtime/Serie/Bar/BarHandler.cs b/Runtime/Serie/Bar/BarHandler.cs index 3f8c5707..f3360129 100644 --- a/Runtime/Serie/Bar/BarHandler.cs +++ b/Runtime/Serie/Bar/BarHandler.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; @@ -78,16 +78,6 @@ namespace XCharts.Runtime } } - public override void OnPointerDown(PointerEventData eventData) - { - if (!serie.context.pointerEnter) return; - if (serie.context.pointerItemDataIndex < 0) return; - if (chart.onPointerClickBar != null) - { - chart.onPointerClickBar(eventData, serie.context.pointerItemDataIndex); - } - } - private void UpdateSerieGridContext() { if (m_SerieGrid == null) @@ -240,7 +230,7 @@ namespace XCharts.Runtime if (isPercentStack) { var valueTotal = chart.GetSerieSameStackTotalValue<Bar>(serie.stack, i); - barHig = valueTotal != 0 ? (float) (relativedValue / valueTotal * relativedAxisLength) : 0; + barHig = valueTotal != 0 ? (float)(relativedValue / valueTotal * relativedAxisLength) : 0; } else { @@ -269,7 +259,7 @@ namespace XCharts.Runtime continue; } - if (serie.show && currHig != 0 && !serie.placeHolder) + if (serie.show && !serie.placeHolder) { switch (serie.barType) { @@ -314,7 +304,7 @@ namespace XCharts.Runtime if (axis.context.minMaxRange <= 0) pY = grid.context.y; else { - var valueLen = (float) ((value - axis.context.minValue) / axis.context.minMaxRange) * grid.context.height; + var valueLen = (float)((value - axis.context.minValue) / axis.context.minMaxRange) * grid.context.height; pY = grid.context.y + valueLen - categoryWidth * 0.5f; } } @@ -336,7 +326,7 @@ namespace XCharts.Runtime if (axis.context.minMaxRange <= 0) pX = grid.context.x; else { - var valueLen = (float) ((value - axis.context.minValue) / axis.context.minMaxRange) * grid.context.width; + var valueLen = (float)((value - axis.context.minValue) / axis.context.minMaxRange) * grid.context.width; pX = grid.context.x + valueLen - categoryWidth * 0.5f; } } diff --git a/Runtime/Serie/Bar/SimplifiedBar.cs b/Runtime/Serie/Bar/SimplifiedBar.cs index 3eed9ff7..0e9703f9 100644 --- a/Runtime/Serie/Bar/SimplifiedBar.cs +++ b/Runtime/Serie/Bar/SimplifiedBar.cs @@ -8,8 +8,8 @@ namespace XCharts.Runtime [SerieConvert(typeof(SimplifiedLine), typeof(Bar))] [CoordOptions(typeof(GridCoord))] [DefaultAnimation(AnimationType.LeftToRight)] - [SerieExtraComponent()] - [SerieDataExtraComponent()] + [SerieComponent()] + [SerieDataComponent()] [SerieDataExtraField()] public class SimplifiedBar : Serie, INeedSerieContainer, ISimplifiedSerie { @@ -32,7 +32,7 @@ namespace XCharts.Runtime return serie; } - public static SimplifiedBar CovertSerie(Serie serie) + public static SimplifiedBar ConvertSerie(Serie serie) { var newSerie = serie.Clone<SimplifiedBar>(); return newSerie; diff --git a/Runtime/Serie/Bar/SimplifiedBarHandler.cs b/Runtime/Serie/Bar/SimplifiedBarHandler.cs index c70f4a7c..508481fe 100644 --- a/Runtime/Serie/Bar/SimplifiedBarHandler.cs +++ b/Runtime/Serie/Bar/SimplifiedBarHandler.cs @@ -14,7 +14,6 @@ namespace XCharts.Runtime public override void Update() { base.Update(); - UpdateSerieContext(); } public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category, @@ -30,7 +29,7 @@ namespace XCharts.Runtime DrawBarSerie(vh, serie, serie.context.colorIndex); } - private void UpdateSerieContext() + public override void UpdateSerieContext() { if (m_SerieGrid == null) return; diff --git a/Runtime/Serie/Candlestick/Candlestick.cs b/Runtime/Serie/Candlestick/Candlestick.cs index 08ff439c..092ec99d 100644 --- a/Runtime/Serie/Candlestick/Candlestick.cs +++ b/Runtime/Serie/Candlestick/Candlestick.cs @@ -5,8 +5,8 @@ namespace XCharts.Runtime [System.Serializable] [SerieHandler(typeof(CandlestickHandler), true)] [DefaultAnimation(AnimationType.LeftToRight)] - [SerieExtraComponent()] - [SerieDataExtraComponent(typeof(ItemStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent()] + [SerieDataComponent(typeof(ItemStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField()] public class Candlestick : Serie, INeedSerieContainer { diff --git a/Runtime/Serie/Candlestick/SimplifiedCandlestick.cs b/Runtime/Serie/Candlestick/SimplifiedCandlestick.cs index 4a8ca1a2..003c72fe 100644 --- a/Runtime/Serie/Candlestick/SimplifiedCandlestick.cs +++ b/Runtime/Serie/Candlestick/SimplifiedCandlestick.cs @@ -5,8 +5,8 @@ namespace XCharts.Runtime [System.Serializable] [SerieHandler(typeof(SimplifiedCandlestickHandler), true)] [DefaultAnimation(AnimationType.LeftToRight)] - [SerieExtraComponent()] - [SerieDataExtraComponent()] + [SerieComponent()] + [SerieDataComponent()] [SerieDataExtraField()] public class SimplifiedCandlestick : Serie, INeedSerieContainer, ISimplifiedSerie { @@ -30,7 +30,7 @@ namespace XCharts.Runtime return serie; } - public static SimplifiedCandlestick CovertSerie(Serie serie) + public static SimplifiedCandlestick ConvertSerie(Serie serie) { var newSerie = serie.Clone<SimplifiedCandlestick>(); return newSerie; diff --git a/Runtime/Serie/Heatmap/Heatmap.cs b/Runtime/Serie/Heatmap/Heatmap.cs index 54a50e98..6897e5ec 100644 --- a/Runtime/Serie/Heatmap/Heatmap.cs +++ b/Runtime/Serie/Heatmap/Heatmap.cs @@ -25,8 +25,8 @@ namespace XCharts.Runtime [DefaultAnimation(AnimationType.LeftToRight)] [RequireChartComponent(typeof(VisualMap))] [CoordOptions(typeof(GridCoord), typeof(PolarCoord))] - [SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField()] public class Heatmap : Serie, INeedSerieContainer { diff --git a/Runtime/Serie/Heatmap/HeatmapHandler.cs b/Runtime/Serie/Heatmap/HeatmapHandler.cs index 45984f16..262a908a 100644 --- a/Runtime/Serie/Heatmap/HeatmapHandler.cs +++ b/Runtime/Serie/Heatmap/HeatmapHandler.cs @@ -27,10 +27,6 @@ namespace XCharts.Runtime public override void Update() { base.Update(); - if (serie.IsUseCoord<GridCoord>()) - UpdateSerieContext(); - else if (serie.IsUseCoord<PolarCoord>()) - UpdateSeriePolarContext(); } public override void DrawSerie(VertexHelper vh) @@ -97,7 +93,7 @@ namespace XCharts.Runtime { var xAxis = chart.GetChartComponent<XAxis>(serie.xAxisIndex); if (xAxis != null) - category = xAxis.GetData((int) serieData.GetData(0)); + category = xAxis.GetData((int)serieData.GetData(0)); } title = serie.serieName; @@ -121,7 +117,15 @@ namespace XCharts.Runtime } } - private void UpdateSerieContext() + public override void UpdateSerieContext() + { + if (serie.IsUseCoord<GridCoord>()) + UpdateSerieGridContext(); + else if (serie.IsUseCoord<PolarCoord>()) + UpdateSeriePolarContext(); + } + + private void UpdateSerieGridContext() { if (m_SerieGrid == null) return; diff --git a/Runtime/Serie/Line/Line.cs b/Runtime/Serie/Line/Line.cs index 3b13b9ef..68176cd6 100644 --- a/Runtime/Serie/Line/Line.cs +++ b/Runtime/Serie/Line/Line.cs @@ -7,7 +7,7 @@ namespace XCharts.Runtime [SerieConvert(typeof(Bar), typeof(Pie))] [CoordOptions(typeof(GridCoord), typeof(PolarCoord))] [DefaultAnimation(AnimationType.LeftToRight)] - [SerieExtraComponent( + [SerieComponent( typeof(LabelStyle), typeof(EndLabelStyle), typeof(LineArrow), @@ -15,7 +15,7 @@ namespace XCharts.Runtime typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent( + [SerieDataComponent( typeof(ItemStyle), typeof(LabelStyle), typeof(SerieSymbol), @@ -38,7 +38,7 @@ namespace XCharts.Runtime return serie; } - public static Line CovertSerie(Serie serie) + public static Line ConvertSerie(Serie serie) { var newSerie = serie.Clone<Line>(); return newSerie; diff --git a/Runtime/Serie/Line/LineHandler.GridCoord.cs b/Runtime/Serie/Line/LineHandler.GridCoord.cs index 615c574c..d5699de2 100644 --- a/Runtime/Serie/Line/LineHandler.GridCoord.cs +++ b/Runtime/Serie/Line/LineHandler.GridCoord.cs @@ -34,7 +34,6 @@ namespace XCharts.Runtime { if (m_SerieGrid == null) return; - var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth); var needCheck = (chart.isPointerInChart && m_SerieGrid.IsPointerEnter()) || m_LegendEnter; if (!needCheck) { @@ -55,6 +54,7 @@ namespace XCharts.Runtime return; } m_LastCheckContextFlag = needCheck; + var lineWidth = serie.lineStyle.GetWidth(chart.theme.serie.lineWidth); var themeSymbolSize = chart.theme.serie.lineSymbolSize; var needInteract = false; serie.ResetDataIndex(); diff --git a/Runtime/Serie/Line/LineHandler.cs b/Runtime/Serie/Line/LineHandler.cs index 10a5c5be..6ff1865c 100644 --- a/Runtime/Serie/Line/LineHandler.cs +++ b/Runtime/Serie/Line/LineHandler.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Text; using UnityEngine; +using UnityEngine.EventSystems; using UnityEngine.UI; using XUGL; @@ -69,7 +70,7 @@ namespace XCharts.Runtime var endLabelList = m_SerieGrid.context.endLabelList; if (endLabelList.Count <= 1) return; - endLabelList.Sort(delegate(ChartLabel a, ChartLabel b) + endLabelList.Sort(delegate (ChartLabel a, ChartLabel b) { if (a == null || b == null) return 1; return b.transform.position.y.CompareTo(a.transform.position.y); @@ -96,5 +97,27 @@ namespace XCharts.Runtime } } } + + public override int GetPointerItemDataIndex() + { + var symbolSize = SerieHelper.GetSysmbolSize(serie, null, chart.theme, chart.theme.serie.lineSymbolSize) * 1.5f; + var count = serie.context.dataPoints.Count; + for (int i = 0; i < count; i++) + { + var index = serie.context.dataIndexs[i]; + var serieData = serie.GetSerieData(index); + if (serieData == null) + continue; + if (serieData.context.isClip) + continue; + + var pos = serie.context.dataPoints[i]; + if (Vector2.Distance(pos, chart.pointerPos) < symbolSize) + { + return i; + } + } + return -1; + } } } \ No newline at end of file diff --git a/Runtime/Serie/Line/LineHelper.cs b/Runtime/Serie/Line/LineHelper.cs index 2998d5a5..45871a0e 100644 --- a/Runtime/Serie/Line/LineHelper.cs +++ b/Runtime/Serie/Line/LineHelper.cs @@ -25,8 +25,8 @@ namespace XCharts.Runtime ThemeStyle theme, VisualMap visualMap, bool isY, Axis axis, Axis relativedAxis, GridCoord grid) { Color32 areaColor, areaToColor; - bool innerFill; - if (!SerieHelper.GetAreaColor(out areaColor, out areaToColor, out innerFill, serie, null, theme, serie.context.colorIndex)) + bool innerFill, toTop; + if (!SerieHelper.GetAreaColor(out areaColor, out areaToColor, out innerFill, out toTop, serie, null, theme, serie.context.colorIndex)) { return; } @@ -47,7 +47,8 @@ namespace XCharts.Runtime visualMap, axis, relativedAxis, - grid); + grid, + toTop); } else { @@ -57,13 +58,14 @@ namespace XCharts.Runtime gridXY + (isY ? grid.context.width : grid.context.height), areaColor, areaToColor, - visualMap); + visualMap, + toTop); } } private static void DrawSerieLineNormalArea(VertexHelper vh, Serie serie, bool isY, float zero, float min, float max, Color32 areaColor, Color32 areaToColor, - VisualMap visualMap, Axis axis, Axis relativedAxis, GridCoord grid) + VisualMap visualMap, Axis axis, Axis relativedAxis, GridCoord grid, bool toTop) { var points = serie.context.drawPoints; var count = points.Count; @@ -117,7 +119,7 @@ namespace XCharts.Runtime if (UGLHelper.GetIntersection(lp, tp, zsp, zep, ref ip)) { if (lerp) - AddVertToVertexHelperWithLerpColor(vh, ip, ip, color, toColor, isY, min, max, i > 0); + AddVertToVertexHelperWithLerpColor(vh, ip, ip, color, toColor, isY, min, max, i > 0, toTop); else { if (lastDataIsIgnore) @@ -133,7 +135,7 @@ namespace XCharts.Runtime } if (lerp) - AddVertToVertexHelperWithLerpColor(vh, tp, zp, color, toColor, isY, min, max, i > 0); + AddVertToVertexHelperWithLerpColor(vh, tp, zp, color, toColor, isY, min, max, i > 0, toTop); else { if (lastDataIsIgnore) @@ -152,7 +154,7 @@ namespace XCharts.Runtime } private static void DrawSerieLineStackArea(VertexHelper vh, Serie serie, Serie lastStackSerie, bool isY, - float zero, float min, float max, Color32 color, Color32 toColor, VisualMap visualMap) + float zero, float min, float max, Color32 color, Color32 toColor, VisualMap visualMap, bool toTop) { if (lastStackSerie == null) return; @@ -170,7 +172,7 @@ namespace XCharts.Runtime var lbp = downPoints[0].position; if (lerp) - AddVertToVertexHelperWithLerpColor(vh, ltp, lbp, color, toColor, isY, min, max, false); + AddVertToVertexHelperWithLerpColor(vh, ltp, lbp, color, toColor, isY, min, max, false, toTop); else UGL.AddVertToVertexHelper(vh, ltp, lbp, color, false); @@ -216,7 +218,7 @@ namespace XCharts.Runtime } if (lerp) - AddVertToVertexHelperWithLerpColor(vh, tp, bp, color, toColor, isY, min, max, true); + AddVertToVertexHelperWithLerpColor(vh, tp, bp, color, toColor, isY, min, max, true, toTop); else UGL.AddVertToVertexHelper(vh, tp, bp, color, true); u++; @@ -234,12 +236,20 @@ namespace XCharts.Runtime } private static void AddVertToVertexHelperWithLerpColor(VertexHelper vh, Vector3 tp, Vector3 bp, - Color32 color, Color32 toColor, bool isY, float min, float max, bool needTriangle) + Color32 color, Color32 toColor, bool isY, float min, float max, bool needTriangle, bool toTop) { - var range = max - min; - var color1 = Color32.Lerp(color, toColor, ((isY ? tp.x : tp.y) - min) / range); - var color2 = Color32.Lerp(color, toColor, ((isY ? bp.x : bp.y) - min) / range); - UGL.AddVertToVertexHelper(vh, tp, bp, color1, color2, needTriangle); + if (toTop) + { + var range = max - min; + var color1 = Color32.Lerp(color, toColor, ((isY ? tp.x : tp.y) - min) / range); + var color2 = Color32.Lerp(color, toColor, ((isY ? bp.x : bp.y) - min) / range); + + UGL.AddVertToVertexHelper(vh, tp, bp, color1, color2, needTriangle); + } + else + { + UGL.AddVertToVertexHelper(vh, tp, bp, toColor, color, needTriangle); + } } internal static void DrawSerieLine(VertexHelper vh, ThemeStyle theme, Serie serie, VisualMap visualMap, diff --git a/Runtime/Serie/Line/SimplifiedLine.cs b/Runtime/Serie/Line/SimplifiedLine.cs index 94470d90..c1a3b041 100644 --- a/Runtime/Serie/Line/SimplifiedLine.cs +++ b/Runtime/Serie/Line/SimplifiedLine.cs @@ -8,8 +8,8 @@ namespace XCharts.Runtime [SerieConvert(typeof(SimplifiedBar), typeof(Line))] [CoordOptions(typeof(GridCoord))] [DefaultAnimation(AnimationType.LeftToRight)] - [SerieExtraComponent(typeof(AreaStyle))] - [SerieDataExtraComponent()] + [SerieComponent(typeof(AreaStyle))] + [SerieDataComponent()] [SerieDataExtraField()] public class SimplifiedLine : Serie, INeedSerieContainer, ISimplifiedSerie { @@ -32,7 +32,7 @@ namespace XCharts.Runtime return serie; } - public static SimplifiedLine CovertSerie(Serie serie) + public static SimplifiedLine ConvertSerie(Serie serie) { var newSerie = serie.Clone<SimplifiedLine>(); return newSerie; diff --git a/Runtime/Serie/Line/SimplifiedLineHandler.cs b/Runtime/Serie/Line/SimplifiedLineHandler.cs index d480010b..2e84beea 100644 --- a/Runtime/Serie/Line/SimplifiedLineHandler.cs +++ b/Runtime/Serie/Line/SimplifiedLineHandler.cs @@ -15,7 +15,6 @@ namespace XCharts.Runtime public override void Update() { base.Update(); - UpdateSerieContext(); } public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category, @@ -31,7 +30,7 @@ namespace XCharts.Runtime DrawLineSerie(vh, serie); } - private void UpdateSerieContext() + public override void UpdateSerieContext() { if (m_SerieGrid == null) return; diff --git a/Runtime/Serie/Parallel/Parallel.cs b/Runtime/Serie/Parallel/Parallel.cs index 09b65279..0062b50c 100644 --- a/Runtime/Serie/Parallel/Parallel.cs +++ b/Runtime/Serie/Parallel/Parallel.cs @@ -6,8 +6,8 @@ namespace XCharts.Runtime [System.Serializable] [SerieHandler(typeof(ParallelHandler), true)] [RequireChartComponent(typeof(ParallelCoord))] - [SerieExtraComponent(typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent(typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent(typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieDataComponent(typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField()] public class Parallel : Serie, INeedSerieContainer { diff --git a/Runtime/Serie/Parallel/ParallelHandler.cs b/Runtime/Serie/Parallel/ParallelHandler.cs index 26a5be3b..5c957c1d 100644 --- a/Runtime/Serie/Parallel/ParallelHandler.cs +++ b/Runtime/Serie/Parallel/ParallelHandler.cs @@ -11,7 +11,6 @@ namespace XCharts.Runtime public override void Update() { base.Update(); - UpdateSerieContext(); } public override void DrawSerie(VertexHelper vh) @@ -19,8 +18,6 @@ namespace XCharts.Runtime DrawParallelSerie(vh, serie); } - private void UpdateSerieContext() { } - private void DrawParallelSerie(VertexHelper vh, Parallel serie) { if (!serie.show) return; diff --git a/Runtime/Serie/Pie/Pie.cs b/Runtime/Serie/Pie/Pie.cs index a86fc07f..9d173270 100644 --- a/Runtime/Serie/Pie/Pie.cs +++ b/Runtime/Serie/Pie/Pie.cs @@ -4,8 +4,8 @@ namespace XCharts.Runtime [SerieConvert(typeof(Line), typeof(Bar))] [SerieHandler(typeof(PieHandler), true)] [DefaultAnimation(AnimationType.Clockwise)] - [SerieExtraComponent(typeof(LabelStyle), typeof(LabelLine), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(LabelLine), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent(typeof(LabelStyle), typeof(LabelLine), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(LabelLine), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField("m_Ignore", "m_Selected", "m_Radius")] public class Pie : Serie { @@ -21,7 +21,7 @@ namespace XCharts.Runtime return serie; } - public static Pie CovertSerie(Serie serie) + public static Pie ConvertSerie(Serie serie) { var newSerie = SerieHelper.CloneSerie<Pie>(serie); return newSerie; diff --git a/Runtime/Serie/Pie/PieHandler.cs b/Runtime/Serie/Pie/PieHandler.cs index 96b8b017..45bf20cf 100644 --- a/Runtime/Serie/Pie/PieHandler.cs +++ b/Runtime/Serie/Pie/PieHandler.cs @@ -12,7 +12,6 @@ namespace XCharts.Runtime public override void Update() { base.Update(); - UpdateSerieContext(); } public override void DrawBase(VertexHelper vh) @@ -79,32 +78,28 @@ namespace XCharts.Runtime public override void OnPointerDown(PointerEventData eventData) { - if (!chart.HasSerie<Pie>()) return; if (chart.pointerPos == Vector2.zero) return; + var dataIndex = GetPiePosIndex(serie, chart.pointerPos); var refresh = false; - for (int i = 0; i < chart.series.Count; i++) + if (dataIndex >= 0) { - var serie = chart.GetSerie(i); - if (!(serie is Pie)) continue; - var index = GetPiePosIndex(serie, chart.pointerPos); - if (index >= 0) + refresh = true; + for (int j = 0; j < serie.data.Count; j++) { - refresh = true; - for (int j = 0; j < serie.data.Count; j++) - { - if (j == index) serie.data[j].context.selected = !serie.data[j].context.selected; - else serie.data[j].context.selected = false; - } - if (chart.onPointerClickPie != null) - { - chart.onPointerClickPie(eventData, i, index); - } + if (j == dataIndex) serie.data[j].context.selected = !serie.data[j].context.selected; + else serie.data[j].context.selected = false; } } if (refresh) chart.RefreshChart(); + base.OnPointerDown(eventData); } - private void UpdateSerieContext() + public override int GetPointerItemDataIndex() + { + return GetPiePosIndex(serie, chart.pointerPos); + } + + public override void UpdateSerieContext() { var needCheck = m_LegendEnter || (chart.isPointerInChart && PointerIsInPieSerie(serie, chart.pointerPos)); var needInteract = false; @@ -123,14 +118,8 @@ namespace XCharts.Runtime serieData.context.highlight = false; serieData.interact.SetValueAndColor(ref needInteract, serieData.context.outsideRadius, color, toColor); } - if (chart.onPointerEnterPie != null) - { - chart.onPointerEnterPie(serie.index, serie.context.pointerItemDataIndex); - } if (needInteract) - { chart.RefreshPainter(serie); - } } return; } @@ -138,6 +127,7 @@ namespace XCharts.Runtime var lastPointerItemDataIndex = serie.context.pointerItemDataIndex; var dataIndex = GetPiePosIndex(serie, chart.pointerPos); serie.context.pointerItemDataIndex = -1; + serie.context.pointerEnter = dataIndex >= 0; for (int i = 0; i < serie.dataCount; i++) { var serieData = serie.data[i]; @@ -162,10 +152,6 @@ namespace XCharts.Runtime if (lastPointerItemDataIndex != serie.context.pointerItemDataIndex) { needInteract = true; - if (chart.onPointerEnterPie != null) - { - chart.onPointerEnterPie(serie.index, serie.context.pointerItemDataIndex); - } } if (needInteract) { @@ -220,21 +206,21 @@ namespace XCharts.Runtime } float degree = serie.pieRoseType == RoseType.Area ? (totalDegree / showdataCount) : - (float) (totalDegree * value / dataTotalFilterMinAngle); + (float)(totalDegree * value / dataTotalFilterMinAngle); if (serie.minAngle > 0 && degree < serie.minAngle) degree = serie.minAngle; serieData.context.toAngle = startDegree + degree; if (serieData.radius > 0) serieData.context.outsideRadius = ChartHelper.GetActualValue(serieData.radius, Mathf.Min(chart.chartWidth, chart.chartHeight)); else serieData.context.outsideRadius = serie.pieRoseType > 0 ? - serie.context.insideRadius + (float) ((serie.context.outsideRadius - serie.context.insideRadius) * value / serie.context.dataMax) : + serie.context.insideRadius + (float)((serie.context.outsideRadius - serie.context.insideRadius) * value / serie.context.dataMax) : serie.context.outsideRadius; if (serieData.context.highlight) { serieData.context.outsideRadius += chart.theme.serie.pieTooltipExtraRadius; } var offset = 0f; - if (serie.pieClickOffset && serieData.selected) + if (serie.pieClickOffset && (serieData.selected || serieData.context.selected)) { offset += chart.theme.serie.pieSelectedOffset; } @@ -248,6 +234,7 @@ namespace XCharts.Runtime } var halfDegree = (serieData.context.toAngle - startDegree) / 2; serieData.context.halfAngle = startDegree + halfDegree; + serieData.context.angle = startDegree + halfDegree; serieData.context.offsetCenter = serie.context.center; serieData.context.insideRadius = serie.context.insideRadius; if (offset > 0) @@ -258,7 +245,7 @@ namespace XCharts.Runtime serieData.context.offsetRadius = 0; serieData.context.insideRadius -= serieData.context.offsetRadius; serieData.context.outsideRadius -= serieData.context.offsetRadius; - if (serie.pieClickOffset && serieData.selected) + if (serie.pieClickOffset && (serieData.selected || serieData.context.selected)) { serieData.context.offsetRadius += chart.theme.serie.pieSelectedOffset; if (serieData.context.insideRadius > 0) @@ -350,7 +337,7 @@ namespace XCharts.Runtime serieData.interact.SetValueAndColor(ref interacting, outsideRadius, color, toColor); } - if (serie.pieClickOffset && serieData.selected) + if (serie.pieClickOffset && (serieData.selected || serieData.context.selected)) { var drawEndDegree = serieData.context.currentAngle; var needRoundCap = serie.roundCap && insideRadius > 0; @@ -491,8 +478,9 @@ namespace XCharts.Runtime pos6 = pos0 + Vector3.left * lineCircleDiff; pos4 = pos6 + Vector3.left * r4; } - var pos5X = (currAngle - startAngle) % 360 > 180 ? - pos2.x - labelLine.lineLength2 : pos2.x + labelLine.lineLength2; + var diffAngle = (currAngle - startAngle) % 360; + var isLeft = diffAngle > 180 || (diffAngle == 0 && serieData.context.startAngle > 0); + var pos5X = isLeft ? pos2.x - labelLine.lineLength2 : pos2.x + labelLine.lineLength2; var pos5 = new Vector3(pos5X, pos2.y); var angle = Vector3.Angle(pos1 - center, pos2 - pos1); if (angle > 15) @@ -537,7 +525,7 @@ namespace XCharts.Runtime var serieData = serie.data[i]; if (angle >= serieData.context.startAngle && angle <= serieData.context.toAngle) { - var ndist = serieData.selected ? + var ndist = (serieData.selected || serieData.context.selected) ? Vector2.Distance(local, serieData.context.offsetCenter) : dist; if (ndist >= serieData.context.insideRadius && ndist <= serieData.context.outsideRadius) diff --git a/Runtime/Serie/Radar/Radar.cs b/Runtime/Serie/Radar/Radar.cs index a0524271..626465e9 100644 --- a/Runtime/Serie/Radar/Radar.cs +++ b/Runtime/Serie/Radar/Radar.cs @@ -6,8 +6,8 @@ namespace XCharts.Runtime [System.Serializable] [SerieHandler(typeof(RadarHandler), true)] [RequireChartComponent(typeof(RadarCoord))] - [SerieExtraComponent(typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent(typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField()] public class Radar : Serie, INeedSerieContainer { diff --git a/Runtime/Serie/Radar/RadarHandler.cs b/Runtime/Serie/Radar/RadarHandler.cs index 8fb0d2fb..d43a6667 100644 --- a/Runtime/Serie/Radar/RadarHandler.cs +++ b/Runtime/Serie/Radar/RadarHandler.cs @@ -12,7 +12,6 @@ namespace XCharts.Runtime public override void Update() { base.Update(); - UpdateSerieContext(); } public override void DrawSerie(VertexHelper vh) @@ -86,22 +85,33 @@ namespace XCharts.Runtime } } - private void UpdateSerieContext() + public override void UpdateSerieContext() { var needCheck = m_LegendEnter || (chart.isPointerInChart && (m_RadarCoord != null && m_RadarCoord.IsPointerEnter())); var needInteract = false; - var needHideAll = false; if (!needCheck) { - if (m_LastCheckContextFlag == needCheck) - return; - needHideAll = true; + if (m_LastCheckContextFlag != needCheck) + { + m_LastCheckContextFlag = needCheck; + serie.context.pointerItemDataIndex = -1; + serie.context.pointerItemDataDimension = -1; + serie.context.pointerEnter = false; + foreach (var serieData in serie.data) + { + serieData.context.highlight = false; + serieData.interact.Reset(); + } + chart.RefreshPainter(serie); + } + return; } m_LastCheckContextFlag = needCheck; serie.highlight = false; serie.context.pointerEnter = false; serie.context.pointerItemDataIndex = -1; + serie.context.pointerItemDataDimension = -1; var areaStyle = serie.areaStyle; var themeSymbolSize = chart.theme.serie.lineSymbolSize; switch (serie.radarType) @@ -112,21 +122,23 @@ namespace XCharts.Runtime var serieData = serie.data[i]; var symbol = SerieHelper.GetSerieSymbol(serie, serieData); var symbolSize = symbol.GetSize(serieData.data, chart.theme.serie.lineSymbolSize); - if (needHideAll || m_LegendEnter) + if (m_LegendEnter) { - serieData.context.highlight = needHideAll ? false : true; + serieData.context.highlight = true; serieData.interact.SetValue(ref needInteract, symbolSize, serieData.context.highlight); } else { serieData.context.highlight = false; - foreach (var pos in serieData.context.dataPoints) + for (int n = 0; n < serieData.context.dataPoints.Count; n++) { + var pos = serieData.context.dataPoints[n]; if (Vector3.Distance(chart.pointerPos, pos) < symbolSize * 2) { serie.highlight = true; serie.context.pointerEnter = true; serie.context.pointerItemDataIndex = i; + serie.context.pointerItemDataDimension = n; serieData.context.highlight = true; break; } @@ -144,6 +156,7 @@ namespace XCharts.Runtime serie.highlight = true; serie.context.pointerEnter = true; serie.context.pointerItemDataIndex = i; + serie.context.pointerItemDataDimension = n; serieData.context.highlight = true; break; } @@ -163,6 +176,7 @@ namespace XCharts.Runtime { serie.context.pointerEnter = true; serie.context.pointerItemDataIndex = i; + serie.context.pointerItemDataDimension = 1; serieData.context.highlight = true; needInteract = true; } @@ -183,6 +197,7 @@ namespace XCharts.Runtime { serie.context.pointerEnter = true; serie.context.pointerItemDataIndex = n; + serie.context.pointerItemDataDimension = 1; p1.context.highlight = true; needInteract = true; break; @@ -264,7 +279,7 @@ namespace XCharts.Runtime max = serie.context.dataMax; } } - var radius = (float) (m_RadarCoord.context.dataRadius * (value - min) / (max - min)); + var radius = (float)(m_RadarCoord.context.dataRadius * (value - min) / (max - min)); var currAngle = startAngle + (n + (m_RadarCoord.positionType == RadarCoord.PositionType.Between ? 0.5f : 0)) * angle; radius *= rate; if (n == 0) @@ -380,7 +395,7 @@ namespace XCharts.Runtime } var lineStyle = SerieHelper.GetLineStyle(serie, serieData); Color32 areaColor, areaToColor; - var colorIndex = serie.colorByData?j : serie.context.colorIndex; + var colorIndex = serie.colorByData ? j : serie.context.colorIndex; var showArea = SerieHelper.GetAreaColor(out areaColor, out areaToColor, serie, serieData, chart.theme, colorIndex - 1); var lineColor = SerieHelper.GetLineColor(serie, serieData, chart.theme, colorIndex); int dataCount = m_RadarCoord.indicatorList.Count; @@ -397,7 +412,7 @@ namespace XCharts.Runtime { lineColor = m_RadarCoord.outRangeColor; } - var radius = (float) (max < 0 ? m_RadarCoord.context.dataRadius - m_RadarCoord.context.dataRadius * value / max : + var radius = (float)(max < 0 ? m_RadarCoord.context.dataRadius - m_RadarCoord.context.dataRadius * value / max : m_RadarCoord.context.dataRadius * value / max); var currAngle = startAngle + (index + (m_RadarCoord.positionType == RadarCoord.PositionType.Between ? 0.5f : 0)) * angle; radius *= rate; diff --git a/Runtime/Serie/Ring/Ring.cs b/Runtime/Serie/Ring/Ring.cs index 6610cdd2..ebd9b660 100644 --- a/Runtime/Serie/Ring/Ring.cs +++ b/Runtime/Serie/Ring/Ring.cs @@ -4,8 +4,8 @@ namespace XCharts.Runtime { [System.Serializable] [SerieHandler(typeof(RingHandler), true)] - [SerieExtraComponent(typeof(LabelStyle), typeof(LabelLine), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(LabelLine), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent(typeof(LabelStyle), typeof(LabelLine), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(LabelLine), typeof(TitleStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField()] public class Ring : Serie { @@ -17,14 +17,14 @@ namespace XCharts.Runtime serie.gap = 10; serie.radius = new float[] { 0.3f, 0.35f }; - var label = serie.AddExtraComponent<LabelStyle>(); + var label = serie.EnsureComponent<LabelStyle>(); label.show = true; label.position = LabelStyle.Position.Center; label.formatter = "{d:f0}%"; label.textStyle.autoColor = true; label.textStyle.fontSize = 28; - var titleStyle = serie.AddExtraComponent<TitleStyle>(); + var titleStyle = serie.EnsureComponent<TitleStyle>(); titleStyle.show = false; titleStyle.offset = new Vector2(0, 30); diff --git a/Runtime/Serie/Ring/RingHandler.cs b/Runtime/Serie/Ring/RingHandler.cs index 08fdcd29..f31021e9 100644 --- a/Runtime/Serie/Ring/RingHandler.cs +++ b/Runtime/Serie/Ring/RingHandler.cs @@ -16,10 +16,9 @@ namespace XCharts.Runtime public override void Update() { base.Update(); - UpdateSerieContext(); } - private void UpdateSerieContext() + public override void UpdateSerieContext() { var needCheck = chart.isPointerInChart || m_LegendEnter; var needInteract = false; diff --git a/Runtime/Serie/Scatter/BaseScatterHandler.cs b/Runtime/Serie/Scatter/BaseScatterHandler.cs index aff96bab..6be8113c 100644 --- a/Runtime/Serie/Scatter/BaseScatterHandler.cs +++ b/Runtime/Serie/Scatter/BaseScatterHandler.cs @@ -13,7 +13,6 @@ namespace XCharts.Runtime public override void Update() { base.Update(); - UpdateSerieContext(); } public override void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category, @@ -63,7 +62,7 @@ namespace XCharts.Runtime } } - private void UpdateSerieContext() + public override void UpdateSerieContext() { var needCheck = m_LegendEnter || (chart.isPointerInChart && (m_Grid == null || m_Grid.IsPointerEnter())); @@ -191,7 +190,7 @@ namespace XCharts.Runtime for (int count = 0; count < symbol.animationSize.Count; count++) { var nowSize = symbol.animationSize[count]; - color.a = (byte) (255 * (symbolSize - nowSize) / symbolSize); + color.a = (byte)(255 * (symbolSize - nowSize) / symbolSize); chart.DrawSymbol(vh, symbol.type, nowSize, symbolBorder, pos, color, toColor, emptyColor, borderColor, symbol.gap, cornerRadius); } @@ -293,7 +292,7 @@ namespace XCharts.Runtime for (int count = 0; count < symbol.animationSize.Count; count++) { var nowSize = symbol.animationSize[count]; - color.a = (byte) (255 * (symbolSize - nowSize) / symbolSize); + color.a = (byte)(255 * (symbolSize - nowSize) / symbolSize); chart.DrawSymbol(vh, symbol.type, nowSize, symbolBorder, pos, color, toColor, emptyColor, borderColor, symbol.gap, cornerRadius); } @@ -321,25 +320,25 @@ namespace XCharts.Runtime { if (axis.IsLog()) { - int minIndex = axis.GetLogMinIndex(); - float nowIndex = axis.GetLogValue(value); - return (nowIndex - minIndex) / axis.splitNumber * totalWidth; + var minIndex = axis.GetLogMinIndex(); + var nowIndex = axis.GetLogValue(value); + return (float)((nowIndex - minIndex) / axis.splitNumber * totalWidth); } else if (axis.IsCategory()) { if (axis.boundaryGap) { - float tick = (float) (totalWidth / (axis.context.minMaxRange + 1)); - return tick / 2 + (float) (value - axis.context.minValue) * tick; + float tick = (float)(totalWidth / (axis.context.minMaxRange + 1)); + return tick / 2 + (float)(value - axis.context.minValue) * tick; } else { - return (float) ((value - axis.context.minValue) / axis.context.minMaxRange * totalWidth); + return (float)((value - axis.context.minValue) / axis.context.minMaxRange * totalWidth); } } else { - return (float) ((value - axis.context.minValue) / axis.context.minMaxRange * totalWidth); + return (float)((value - axis.context.minValue) / axis.context.minMaxRange * totalWidth); } } } diff --git a/Runtime/Serie/Scatter/EffectScatter.cs b/Runtime/Serie/Scatter/EffectScatter.cs index 55696652..ca10028e 100644 --- a/Runtime/Serie/Scatter/EffectScatter.cs +++ b/Runtime/Serie/Scatter/EffectScatter.cs @@ -5,8 +5,8 @@ namespace XCharts.Runtime [System.Serializable] [SerieHandler(typeof(EffectScatterHandler), true)] [CoordOptions(typeof(GridCoord), typeof(SingleAxisCoord))] - [SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField("m_Radius")] public class EffectScatter : BaseScatter { diff --git a/Runtime/Serie/Scatter/Scatter.cs b/Runtime/Serie/Scatter/Scatter.cs index daf2ee56..a6367539 100644 --- a/Runtime/Serie/Scatter/Scatter.cs +++ b/Runtime/Serie/Scatter/Scatter.cs @@ -5,8 +5,8 @@ namespace XCharts.Runtime [System.Serializable] [SerieHandler(typeof(ScatterHandler), true)] [CoordOptions(typeof(GridCoord), typeof(SingleAxisCoord))] - [SerieExtraComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] - [SerieDataExtraComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] + [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))] [SerieDataExtraField("m_Radius")] public class Scatter : BaseScatter { diff --git a/Runtime/Serie/Serie.ExtraComponent.cs b/Runtime/Serie/Serie.ExtraComponent.cs index 06eb4726..ac7d546a 100644 --- a/Runtime/Serie/Serie.ExtraComponent.cs +++ b/Runtime/Serie/Serie.ExtraComponent.cs @@ -8,7 +8,8 @@ namespace XCharts.Runtime public partial class Serie { public static Dictionary<Type, string> extraComponentMap = new Dictionary<Type, string> - { { typeof(LabelStyle), "m_Labels" }, + { + { typeof(LabelStyle), "m_Labels" }, { typeof(LabelLine), "m_LabelLines" }, { typeof(EndLabelStyle), "m_EndLabels" }, { typeof(LineArrow), "m_LineArrows" }, @@ -71,7 +72,11 @@ namespace XCharts.Runtime /// </summary> public SelectStyle selectStyle { get { return m_SelectStyles.Count > 0 ? m_SelectStyles[0] : null; } } - public void RemoveAllExtraComponent() + /// <summary> + /// Remove all extra components. + /// |移除所有额外组件。 + /// </summary> + public void RemoveAllComponents() { var serieType = GetType(); foreach (var kv in extraComponentMap) @@ -81,16 +86,72 @@ namespace XCharts.Runtime SetAllDirty(); } - public T AddExtraComponent<T>() where T : ChildComponent, ISerieExtraComponent + [Obsolete("Use EnsureComponent<T>() instead.")] + public T AddExtraComponent<T>() where T : ChildComponent, ISerieComponent { - return AddExtraComponent(typeof(T)) as T; + return EnsureComponent<T>(); } - public ISerieExtraComponent AddExtraComponent(Type type) + public T GetComponent<T>() where T : ChildComponent, ISerieComponent { - if (GetType().IsDefined(typeof(SerieExtraComponentAttribute), false)) + return GetComponent(typeof(T)) as T; + } + + /// <summary> + /// Ensure the serie has the component. If not, add it. + /// |确保系列有该组件。如果没有,则添加。 + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns>component or null</returns> + public T EnsureComponent<T>() where T : ChildComponent, ISerieComponent + { + return EnsureComponent(typeof(T)) as T; + } + + public bool CanAddComponent<T>() where T : ChildComponent, ISerieComponent + { + return CanAddComponent(typeof(T)); + } + + public bool CanAddComponent(Type type) + { + if (GetType().IsDefined(typeof(SerieComponentAttribute), false)) { - var attr = GetType().GetAttribute<SerieExtraComponentAttribute>(); + var attr = GetType().GetAttribute<SerieComponentAttribute>(); + if (attr.Contains(type)) + { + return true; + } + } + return false; + } + + public ISerieComponent GetComponent(Type type) + { + if (GetType().IsDefined(typeof(SerieComponentAttribute), false)) + { + var attr = GetType().GetAttribute<SerieComponentAttribute>(); + if (attr.Contains(type)) + { + var fieldName = string.Empty; + if (extraComponentMap.TryGetValue(type, out fieldName)) + { + var field = typeof(Serie).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic); + if (ReflectionUtil.InvokeListCount(this, field) > 0) + { + return ReflectionUtil.InvokeListGet<ISerieComponent>(this, field, 0); + } + } + } + } + return null; + } + + public ISerieComponent EnsureComponent(Type type) + { + if (GetType().IsDefined(typeof(SerieComponentAttribute), false)) + { + var attr = GetType().GetAttribute<SerieComponentAttribute>(); if (attr.Contains(type)) { var fieldName = string.Empty; @@ -99,32 +160,32 @@ namespace XCharts.Runtime var field = typeof(Serie).GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic); if (ReflectionUtil.InvokeListCount(this, field) <= 0) { - var extraComponent = Activator.CreateInstance(type) as ISerieExtraComponent; + var extraComponent = Activator.CreateInstance(type) as ISerieComponent; ReflectionUtil.InvokeListAdd(this, field, extraComponent); SetAllDirty(); return extraComponent; } else { - return ReflectionUtil.InvokeListGet<ISerieExtraComponent>(this, field, 0); + return ReflectionUtil.InvokeListGet<ISerieComponent>(this, field, 0); } } } } - throw new System.Exception(string.Format("Serie {0} not support extra component: {1}", + throw new System.Exception(string.Format("Serie {0} not support component: {1}", GetType().Name, type.Name)); } - public void RemoveExtraComponent<T>() where T : ISerieExtraComponent + public void RemoveComponent<T>() where T : ISerieComponent { - RemoveExtraComponent(typeof(T)); + RemoveComponent(typeof(T)); } - public void RemoveExtraComponent(Type type) + public void RemoveComponent(Type type) { - if (GetType().IsDefined(typeof(SerieExtraComponentAttribute), false)) + if (GetType().IsDefined(typeof(SerieComponentAttribute), false)) { - var attr = GetType().GetAttribute<SerieExtraComponentAttribute>(); + var attr = GetType().GetAttribute<SerieComponentAttribute>(); if (attr.Contains(type)) { var fieldName = string.Empty; @@ -137,17 +198,6 @@ namespace XCharts.Runtime } } } - throw new System.Exception(string.Format("Serie {0} not support extra component: {1}", - GetType().Name, type.Name)); - } - - private void RemoveExtraComponentList<T>(List<T> list) where T : ISerieExtraComponent - { - if (list.Count > 0) - { - list.Clear(); - SetAllDirty(); - } } } } \ No newline at end of file diff --git a/Runtime/Serie/Serie.cs b/Runtime/Serie/Serie.cs index 5cabe856..2f5e9ec4 100644 --- a/Runtime/Serie/Serie.cs +++ b/Runtime/Serie/Serie.cs @@ -230,7 +230,6 @@ namespace XCharts.Runtime [SerializeField] private string m_SerieName; [SerializeField][Since("v3.2.0")] private SerieState m_State = SerieState.Normal; [SerializeField][Since("v3.2.0")] private SerieColorBy m_ColorBy = SerieColorBy.Default; - [SerializeField][Since("v3.4.0")] private Color32 m_MarkColor; [SerializeField] private string m_Stack; [SerializeField] private int m_XAxisIndex = 0; [SerializeField] private int m_YAxisIndex = 0; @@ -248,7 +247,7 @@ namespace XCharts.Runtime [SerializeField] private float m_SampleAverage = 0; [SerializeField] private LineType m_LineType = LineType.Normal; - [SerializeField][Since("v3.4.0")] private bool m_SmoothLimit = true; + [SerializeField][Since("v3.4.0")] private bool m_SmoothLimit = false; [SerializeField] private BarType m_BarType = BarType.Normal; [SerializeField] private bool m_BarPercentStack = false; [SerializeField] private float m_BarWidth = 0; @@ -310,6 +309,27 @@ namespace XCharts.Runtime [NonSerialized] public List<SerieData> m_FilterData = new List<SerieData>(); [NonSerialized] private bool m_NameDirty; + /// <summary> + /// event callback when click serie. + /// |点击系列时的回调。 + /// </summary> + public Action<SerieEventData> onClick { get; set; } + /// <summary> + /// event callback when mouse down on serie. + /// |鼠标按下时的回调。 + /// </summary> + public Action<SerieEventData> onDown { get; set; } + /// <summary> + /// event callback when mouse enter serie. + /// |鼠标进入时的回调。 + /// </summary> + public Action<SerieEventData> onEnter { get; set; } + /// <summary> + /// event callback when mouse leave serie. + /// |鼠标离开时的回调。 + /// </summary> + public Action<SerieEventData> onExit { get; set; } + /// <summary> /// The index of serie. /// |系列索引。 @@ -372,19 +392,10 @@ namespace XCharts.Runtime public SerieColorBy colorBy { //get { return m_ColorBy; } - get { return m_ColorBy == SerieColorBy.Default?defaultColorBy : m_ColorBy; } + get { return m_ColorBy == SerieColorBy.Default ? defaultColorBy : m_ColorBy; } set { if (PropertyUtil.SetStruct(ref m_ColorBy, value)) { SetAllDirty(); } } } /// <summary> - /// Serie's mark color. It is only used to display Legend and Tooltip, and does not affect the drawing color. The default value is clear. - /// |Serie的标识颜色。仅用于Legend和Tooltip的展示,不影响绘制颜色,默认为clear。 - /// </summary> - public Color32 markColor - { - get { return m_MarkColor; } - set { if (PropertyUtil.SetStruct(ref m_MarkColor, value)) { SetAllDirty(); } } - } - /// <summary> /// If stack the value. On the same category axis, the series with the same stack name would be put on top of each other. /// |数据堆叠,同个类目轴上系列配置相同的stack值后,后一个系列的值会在前一个系列的值上相加。 /// </summary> @@ -1071,7 +1082,7 @@ namespace XCharts.Runtime var max = double.MinValue; foreach (var sdata in data) { - if (sdata.show && !IsIgnoreValue(sdata.data[1]) && sdata.data[1] > max) + if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1]) && sdata.data[1] > max) { max = sdata.data[1]; } @@ -1090,7 +1101,7 @@ namespace XCharts.Runtime var max = double.MinValue; foreach (var sdata in data) { - if (sdata.show && !IsIgnoreValue(sdata.data[0]) && sdata.data[0] > max) + if (sdata.show && !IsIgnoreValue(sdata, sdata.data[0]) && sdata.data[0] > max) { max = sdata.data[0]; } @@ -1109,7 +1120,7 @@ namespace XCharts.Runtime var min = double.MaxValue; foreach (var sdata in data) { - if (sdata.show && !IsIgnoreValue(sdata.data[1]) && sdata.data[1] < min) + if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1]) && sdata.data[1] < min) { min = sdata.data[1]; } @@ -1128,7 +1139,7 @@ namespace XCharts.Runtime var min = double.MaxValue; foreach (var sdata in data) { - if (sdata.show && !IsIgnoreValue(sdata.data[0]) && sdata.data[0] < min) + if (sdata.show && !IsIgnoreValue(sdata, sdata.data[0]) && sdata.data[0] < min) { min = sdata.data[0]; } @@ -1149,7 +1160,7 @@ namespace XCharts.Runtime { foreach (var sdata in data) { - if (sdata.show && !IsIgnoreValue(sdata.data[1])) + if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1])) total += sdata.data[1]; } } @@ -1159,7 +1170,7 @@ namespace XCharts.Runtime var unscaledTime = animation.unscaledTime; foreach (var sdata in data) { - if (sdata.show && !IsIgnoreValue(sdata.data[1])) + if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1])) total += sdata.GetCurrData(1, duration, unscaledTime); } } @@ -1177,7 +1188,7 @@ namespace XCharts.Runtime double total = 0; foreach (var sdata in data) { - if (sdata.show && !IsIgnoreValue(sdata.data[1])) + if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1])) total += sdata.data[0]; } return total; @@ -1658,7 +1669,7 @@ namespace XCharts.Runtime /// <param name="index"></param> /// <param name="xValue"></param> /// <param name="yValue"></param> - public bool UpdateXYData(int index, float xValue, float yValue) + public bool UpdateXYData(int index, double xValue, double yValue) { var flag1 = UpdateData(index, 0, xValue); var flag2 = UpdateData(index, 1, yValue); @@ -1790,7 +1801,7 @@ namespace XCharts.Runtime public bool IsIgnoreValue(SerieData serieData, int dimension = 1) { - return serieData.ignore || IsIgnoreValue(serieData.GetData(dimension)); + return IsIgnoreValue(serieData, serieData.GetData(dimension)); } public bool IsIgnoreValue(double value) @@ -1798,6 +1809,11 @@ namespace XCharts.Runtime return m_Ignore && MathUtil.Approximately(value, m_IgnoreValue); } + public bool IsIgnoreValue(SerieData serieData, double value) + { + return serieData.ignore || IsIgnoreValue(value); + } + public bool IsIgnorePoint(int index) { if (index >= 0 && index < dataCount) diff --git a/Runtime/Serie/SerieContext.cs b/Runtime/Serie/SerieContext.cs index 4408e499..12b98f0d 100644 --- a/Runtime/Serie/SerieContext.cs +++ b/Runtime/Serie/SerieContext.cs @@ -26,6 +26,10 @@ namespace XCharts.Runtime /// </summary> public int pointerItemDataIndex = -1; /// <summary> + /// 鼠标当前指示的数据项维度 + /// </summary> + public int pointerItemDataDimension = 1; + /// <summary> /// 鼠标所在轴线上的数据项索引(可能有多个) /// </summary> public List<int> pointerAxisDataIndexs = new List<int>(); diff --git a/Runtime/Serie/SerieData.cs b/Runtime/Serie/SerieData.cs index 081cf9b2..2f448df8 100644 --- a/Runtime/Serie/SerieData.cs +++ b/Runtime/Serie/SerieData.cs @@ -234,71 +234,157 @@ namespace XCharts.Runtime m_SelectStyles.Clear(); } + [Obsolete("GetOrAddComponent is obsolete. Use EnsureComponent instead.")] public T GetOrAddComponent<T>() where T : ChildComponent, ISerieDataComponent { - return GetOrAddComponent(typeof(T)) as T; + return EnsureComponent<T>(); } - public ISerieDataComponent GetOrAddComponent(Type type) + /// <summary> + /// Get the component of the serie data. return null if not exist. + /// |获取数据项的指定类型的组件,如果不存在则返回null。 + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + public T GetComponent<T>() where T : ChildComponent, ISerieDataComponent + { + return GetComponentInternal(typeof(T), false) as T; + } + + /// <summary> + /// Ensure the serie data has the component, if not, add it. + /// |确保数据项有指定类型的组件,如果没有则添加。 + /// </summary> + /// <typeparam name="T"></typeparam> + /// <returns></returns> + [Since("v3.6.0")] + public T EnsureComponent<T>() where T : ChildComponent, ISerieDataComponent + { + return GetComponentInternal(typeof(T), true) as T; + } + + /// <summary> + /// Ensure the serie data has the component, if not, add it. + /// |确保数据项有指定类型的组件,如果没有则添加。 + /// </summary> + /// <param name="type"></param> + /// <returns></returns> + [Since("v3.6.0")] + public ISerieDataComponent EnsureComponent(Type type) + { + return GetComponentInternal(type, true); + } + + private ISerieDataComponent GetComponentInternal(Type type, bool addIfNotExist) { if (type == typeof(ItemStyle)) { if (m_ItemStyles.Count == 0) - m_ItemStyles.Add(new ItemStyle() { show = true }); + { + if (addIfNotExist) + m_ItemStyles.Add(new ItemStyle() { show = true }); + else + return null; + } return m_ItemStyles[0]; } else if (type == typeof(LabelStyle)) { if (m_Labels.Count == 0) - m_Labels.Add(new LabelStyle() { show = true }); + { + if (addIfNotExist) + m_Labels.Add(new LabelStyle() { show = true }); + else + return null; + } return m_Labels[0]; } else if (type == typeof(LabelLine)) { if (m_LabelLines.Count == 0) - m_LabelLines.Add(new LabelLine() { show = true }); + { + if (addIfNotExist) + m_LabelLines.Add(new LabelLine() { show = true }); + else + return null; + } return m_LabelLines[0]; } else if (type == typeof(EmphasisStyle)) { if (m_EmphasisStyles.Count == 0) - m_EmphasisStyles.Add(new EmphasisStyle() { show = true }); + { + if (addIfNotExist) + m_EmphasisStyles.Add(new EmphasisStyle() { show = true }); + else + return null; + } return m_EmphasisStyles[0]; } else if (type == typeof(BlurStyle)) { if (m_BlurStyles.Count == 0) - m_BlurStyles.Add(new BlurStyle() { show = true }); + { + if (addIfNotExist) + m_BlurStyles.Add(new BlurStyle() { show = true }); + else + return null; + } return m_BlurStyles[0]; } else if (type == typeof(SelectStyle)) { if (m_SelectStyles.Count == 0) - m_SelectStyles.Add(new SelectStyle() { show = true }); + { + if (addIfNotExist) + m_SelectStyles.Add(new SelectStyle() { show = true }); + else + return null; + } return m_SelectStyles[0]; } else if (type == typeof(SerieSymbol)) { if (m_Symbols.Count == 0) - m_Symbols.Add(new SerieSymbol() { show = true }); + { + if (addIfNotExist) + m_Symbols.Add(new SerieSymbol() { show = true }); + else + return null; + } return m_Symbols[0]; } else if (type == typeof(LineStyle)) { if (m_LineStyles.Count == 0) - m_LineStyles.Add(new LineStyle() { show = true }); + { + if (addIfNotExist) + m_LineStyles.Add(new LineStyle() { show = true }); + else + return null; + } return m_LineStyles[0]; } else if (type == typeof(AreaStyle)) { if (m_AreaStyles.Count == 0) - m_AreaStyles.Add(new AreaStyle() { show = true }); + { + if (addIfNotExist) + m_AreaStyles.Add(new AreaStyle() { show = true }); + else + return null; + } return m_AreaStyles[0]; } else if (type == typeof(TitleStyle)) { if (m_TitleStyles.Count == 0) - m_TitleStyles.Add(new TitleStyle() { show = true }); + { + if (addIfNotExist) + m_TitleStyles.Add(new TitleStyle() { show = true }); + else + return null; + } return m_TitleStyles[0]; } else @@ -398,7 +484,7 @@ namespace XCharts.Runtime return GetCurrData(index, animationDuration, inverse, 0, 0, unscaledTime); } - public double GetCurrData(int index, float animationDuration, bool inverse, double min, double max, bool unscaledTime) + public double GetCurrData(int index, float animationDuration, bool inverse, double min, double max, bool unscaledTime, bool loop = false) { if (index < m_DataUpdateFlag.Count && m_DataUpdateFlag[index] && animationDuration > 0) { @@ -410,7 +496,13 @@ namespace XCharts.Runtime if (rate < 1) { CheckLastData(unscaledTime); - var curr = MathUtil.Lerp(GetPreviousData(index), GetData(index), rate); + var prev = GetPreviousData(index); + var next = GetData(index); + if (loop) + { + if (next <= min && prev != 0) next = max; + } + var curr = MathUtil.Lerp(prev, next, rate); if (min != 0 || max != 0) { if (inverse) @@ -576,6 +668,12 @@ namespace XCharts.Runtime if (labelObject != null) labelObject.SetActive(flag); } + public void SetPolygon(params Vector2[] points) + { + m_PolygonPoints.Clear(); + m_PolygonPoints.AddRange(points); + } + public void SetPolygon(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4) { m_PolygonPoints.Clear(); @@ -584,6 +682,7 @@ namespace XCharts.Runtime m_PolygonPoints.Add(p3); m_PolygonPoints.Add(p4); } + public void SetPolygon(Vector2 p1, Vector2 p2, Vector2 p3, Vector2 p4, Vector2 p5) { SetPolygon(p1, p2, p3, p4); diff --git a/Runtime/Serie/SerieHandler.cs b/Runtime/Serie/SerieHandler.cs index 401fbb43..37d39b04 100644 --- a/Runtime/Serie/SerieHandler.cs +++ b/Runtime/Serie/SerieHandler.cs @@ -31,14 +31,18 @@ namespace XCharts.Runtime public virtual void OnScroll(PointerEventData eventData) { } public virtual void RefreshLabelNextFrame() { } public virtual void RefreshLabelInternal() { } + public virtual void UpdateSerieContext() { } public virtual void UpdateTooltipSerieParams(int dataIndex, bool showCategory, string category, string marker, string itemFormatter, string numericFormatter, string ignoreDataDefaultContent, - ref List<SerieParams> paramList, ref string title) { } + ref List<SerieParams> paramList, ref string title) + { } public virtual void OnLegendButtonClick(int index, string legendName, bool show) { } public virtual void OnLegendButtonEnter(int index, string legendName) { } public virtual void OnLegendButtonExit(int index, string legendName) { } internal abstract void SetSerie(Serie serie); + public virtual int GetPointerItemDataIndex() { return -1; } + public virtual int GetPointerItemDataDimension() { return 1; } } public abstract class SerieHandler<T> : SerieHandler where T : Serie @@ -62,7 +66,7 @@ namespace XCharts.Runtime internal override void SetSerie(Serie serie) { - this.serie = (T) serie; + this.serie = (T)serie; this.serie.context.param.serieType = typeof(T); m_NeedInitComponent = true; AnimationStyleHelper.UpdateSerieAnimation(serie); @@ -121,6 +125,36 @@ namespace XCharts.Runtime serie.ResetInteract(); serie.ClearVerticesDirty(); } + UpdateSerieContextInternal(); + } + + private void UpdateSerieContextInternal() + { + var lastEnter = serie.context.pointerEnter; + var lastDataIndex = serie.context.pointerItemDataIndex; + UpdateSerieContext(); + if (lastEnter != serie.context.pointerEnter || lastDataIndex != serie.context.pointerItemDataIndex) + { + if (chart.onSerieEnter != null || chart.onSerieExit != null || serie.onEnter != null || serie.onExit != null) + { + var dataIndex = GetPointerItemDataIndex(); + var dimension = GetPointerItemDataDimension(); + var value = serie.GetData(dataIndex, dimension); + var data = SerieEventDataPool.Get(chart.pointerPos, serie.index, dataIndex, dimension, value); + if (serie.context.pointerEnter) + { + if (serie.onEnter != null) serie.onEnter(data); + if (chart.onSerieEnter != null) chart.onSerieEnter(data); + } + else + { + data.dataIndex = lastDataIndex; + if (serie.onExit != null) serie.onExit(data); + if (chart.onSerieExit != null) chart.onSerieExit(data); + } + SerieEventDataPool.Release(data); + } + } } public override void RefreshLabelNextFrame() @@ -189,7 +223,7 @@ namespace XCharts.Runtime { if (m_SerieRoot != null) { - var rect = ChartHelper.GetOrAddComponent<RectTransform>(m_SerieRoot); + var rect = ChartHelper.EnsureComponent<RectTransform>(m_SerieRoot); rect.localPosition = Vector3.zero; rect.sizeDelta = chart.chartSizeDelta; rect.anchorMin = chart.chartMinAnchor; @@ -289,7 +323,7 @@ namespace XCharts.Runtime return; } InitRoot(); - var dataAutoColor = (Color) chart.GetLegendRealShowNameColor(serie.legendName); + var dataAutoColor = (Color)chart.GetLegendRealShowNameColor(serie.legendName); m_EndLabel = ChartHelper.AddChartLabel(s_SerieEndLabelObjectName, m_SerieRoot.transform, serie.endLabel, chart.theme.common, "", dataAutoColor, TextAnchor.MiddleLeft); m_EndLabel.SetActive(serie.endLabel.show); @@ -385,6 +419,7 @@ namespace XCharts.Runtime var isIgnore = serie.IsIgnoreIndex(serieData.index, defaultDimension); if (serie.show && currLabel != null && + currLabel.show && serieData.context.canShowLabel && !isIgnore) { @@ -468,6 +503,13 @@ namespace XCharts.Runtime var labelPosition = GetSerieDataLabelPosition(serieData, currLabel); var offset = GetSerieDataLabelOffset(serieData, currLabel); serieData.labelObject.SetPosition(labelPosition + offset); + if (currLabel.autoRotate && serieData.context.angle != 0) + { + if (serieData.context.angle > 90 && serieData.context.angle < 270) + serieData.labelObject.SetRotate(180 - serieData.context.angle + currLabel.rotate); + else + serieData.labelObject.SetRotate(-serieData.context.angle + currLabel.rotate); + } } public virtual Vector3 GetSerieDataLabelPosition(SerieData serieData, LabelStyle label) @@ -492,7 +534,7 @@ namespace XCharts.Runtime var colorIndex = serie.colorByData ? serieData.index : serie.index; Color32 color, toColor; SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex, SerieState.Normal, false); - return (Color) color; + return (Color)color; } protected void UpdateCoordSerieParams(ref List<SerieParams> paramList, ref string title, @@ -536,7 +578,7 @@ namespace XCharts.Runtime param.columns.Add(param.marker); param.columns.Add(showCategory ? category : serie.serieName); - param.columns.Add(ignore?ignoreDataDefaultContent : ChartCached.NumberToStr(param.value, param.numericFormatter)); + param.columns.Add(ignore ? ignoreDataDefaultContent : ChartCached.NumberToStr(param.value, param.numericFormatter)); paramList.Add(param); } @@ -565,7 +607,7 @@ namespace XCharts.Runtime return; if (colorIndex < 0) - colorIndex = serie.colorByData?dataIndex : chart.GetLegendRealShowNameIndex(serieData.name); + colorIndex = serie.colorByData ? dataIndex : chart.GetLegendRealShowNameIndex(serieData.name); Color32 color, toColor; SerieHelper.GetItemColor(out color, out toColor, serie, serieData, chart.theme, colorIndex, SerieState.Normal); @@ -579,7 +621,7 @@ namespace XCharts.Runtime param.dataCount = serie.dataCount; param.value = serieData.GetData(param.dimension); param.ignore = ignore; - param.total = serie.multiDimensionLabel? serieData.GetTotalData() : serie.GetDataTotal(defaultDimension); + param.total = serie.multiDimensionLabel ? serieData.GetTotalData() : serie.GetDataTotal(defaultDimension); param.color = color; param.marker = SerieHelper.GetItemMarker(serie, serieData, marker); param.itemFormatter = itemFormatter; @@ -589,7 +631,7 @@ namespace XCharts.Runtime param.columns.Add(param.marker); param.columns.Add(serieData.name); - param.columns.Add(ignore?ignoreDataDefaultContent : ChartCached.NumberToStr(param.value, param.numericFormatter)); + param.columns.Add(ignore ? ignoreDataDefaultContent : ChartCached.NumberToStr(param.value, param.numericFormatter)); paramList.Add(param); } @@ -612,5 +654,47 @@ namespace XCharts.Runtime chart.DrawSymbol(vh, symbol.type, symbol.size, 1, pos, color, color, ColorUtil.clearColor32, color, symbol.gap, null); } + + public override void OnPointerDown(PointerEventData eventData) + { + if (serie.onDown == null && chart.onSerieDown == null) return; + if (!serie.context.pointerEnter) return; + var dataIndex = GetPointerItemDataIndex(); + if (dataIndex < 0) return; + var dimension = GetPointerItemDataDimension(); + var value = serie.GetData(dataIndex, dimension); + var data = SerieEventDataPool.Get(chart.pointerPos, serie.index, dataIndex, dimension, value); + if (chart.onSerieDown != null) + chart.onSerieDown(data); + if (serie.onDown != null) + serie.onDown(data); + SerieEventDataPool.Release(data); + } + + public override void OnPointerClick(PointerEventData eventData) + { + if (serie.onClick == null && chart.onSerieClick == null) return; + if (!serie.context.pointerEnter) return; + var dataIndex = GetPointerItemDataIndex(); + if (dataIndex < 0) return; + var dimension = GetPointerItemDataDimension(); + var value = serie.GetData(dataIndex, dimension); + var data = SerieEventDataPool.Get(chart.pointerPos, serie.index, dataIndex, dimension, value); + if (chart.onSerieClick != null) + chart.onSerieClick(data); + if (serie.onClick != null) + serie.onClick(data); + SerieEventDataPool.Release(data); + } + + public override int GetPointerItemDataIndex() + { + return serie.context.pointerItemDataIndex; + } + + public override int GetPointerItemDataDimension() + { + return serie.context.pointerItemDataDimension; + } } } \ No newline at end of file diff --git a/Runtime/Serie/SerieHelper.cs b/Runtime/Serie/SerieHelper.cs index 3e4e52c5..aae27558 100644 --- a/Runtime/Serie/SerieHelper.cs +++ b/Runtime/Serie/SerieHelper.cs @@ -17,7 +17,7 @@ namespace XCharts.Runtime if (serieData.show && serieData.data.Count > dimension) { var value = serieData.data[dimension]; - if (value < min && !serie.IsIgnoreValue(value)) min = value; + if (value < min && !serie.IsIgnoreValue(serieData, value)) min = value; } } return min == double.MaxValue ? 0 : min; @@ -33,7 +33,7 @@ namespace XCharts.Runtime if (serieData.show && serieData.data.Count > dimension) { var value = serieData.data[dimension]; - if (value < min && !serie.IsIgnoreValue(value)) + if (value < min && !serie.IsIgnoreValue(serieData, value)) { min = value; minData = serieData; @@ -52,7 +52,7 @@ namespace XCharts.Runtime if (serieData.show && serieData.data.Count > dimension) { var value = serieData.data[dimension]; - if (value > max && !serie.IsIgnoreValue(value)) max = value; + if (value > max && !serie.IsIgnoreValue(serieData, value)) max = value; } } return max == double.MinValue ? 0 : max; @@ -68,7 +68,7 @@ namespace XCharts.Runtime if (serieData.show && serieData.data.Count > dimension) { var value = serieData.data[dimension]; - if (value > max && !serie.IsIgnoreValue(value)) + if (value > max && !serie.IsIgnoreValue(serieData, value)) { max = value; maxData = serieData; @@ -88,7 +88,7 @@ namespace XCharts.Runtime if (serieData.show && serieData.data.Count > dimension) { var value = serieData.data[dimension]; - if (!serie.IsIgnoreValue(value)) + if (!serie.IsIgnoreValue(serieData, value)) total += value; } } @@ -106,7 +106,7 @@ namespace XCharts.Runtime if (serieData.show && serieData.data.Count > dimension) { var value = serieData.data[dimension]; - if (!serie.IsIgnoreValue(value)) + if (!serie.IsIgnoreValue(serieData, value)) s_TempList.Add(value); } } @@ -137,7 +137,7 @@ namespace XCharts.Runtime if (serieData.show && serieData.data.Count > dimension) { var value = serieData.data[dimension]; - if (!serie.IsIgnoreValue(value)) + if (!serie.IsIgnoreValue(serieData, value)) { if (value > max) max = value; if (value < min) min = value; @@ -177,7 +177,7 @@ namespace XCharts.Runtime for (int j = 0; j < count; j++) { var value = serieData.data[j]; - if (!serie.IsIgnoreValue(value)) + if (!serie.IsIgnoreValue(serieData, value)) { if (value > max) max = value; if (value < min) min = value; @@ -268,7 +268,7 @@ namespace XCharts.Runtime { if (serieData == null) return GetSerieState(serie); if (serieData.context.highlight) return SerieState.Emphasis; - if (serieData.state == SerieState.Auto) return defaultSerieState?serie.state : GetSerieState(serie); + if (serieData.state == SerieState.Auto) return defaultSerieState ? serie.state : GetSerieState(serie); return serieData.state; } @@ -292,7 +292,7 @@ namespace XCharts.Runtime public static void GetItemColor(out Color32 color, out Color32 toColor, Serie serie, SerieData serieData, ThemeStyle theme, SerieState state = SerieState.Auto) { - var colorIndex = serieData != null && serie.colorByData? serieData.index : serie.context.colorIndex; + var colorIndex = serieData != null && serie.colorByData ? serieData.index : serie.context.colorIndex; GetItemColor(out color, out toColor, serie, serieData, theme, colorIndex, state, true); } @@ -438,7 +438,7 @@ namespace XCharts.Runtime if (state == SerieState.Auto) state = GetSerieState(serie, serieData); if (state == SerieState.Normal) { - return serieData != null && serieData.itemStyle != null? serieData.itemStyle : serie.itemStyle; + return serieData != null && serieData.itemStyle != null ? serieData.itemStyle : serie.itemStyle; } else { @@ -452,7 +452,7 @@ namespace XCharts.Runtime if (state == SerieState.Auto) state = GetSerieState(serie, serieData); if (state == SerieState.Normal) { - return serieData != null && serieData.labelStyle != null? serieData.labelStyle : serie.label; + return serieData != null && serieData.labelStyle != null ? serieData.labelStyle : serie.label; } else { @@ -466,7 +466,7 @@ namespace XCharts.Runtime if (state == SerieState.Auto) state = GetSerieState(serie, serieData); if (state == SerieState.Normal) { - return serieData != null && serieData.labelLine != null? serieData.labelLine : serie.labelLine; + return serieData != null && serieData.labelLine != null ? serieData.labelLine : serie.labelLine; } else { @@ -480,7 +480,7 @@ namespace XCharts.Runtime if (state == SerieState.Auto) state = GetSerieState(serie, serieData); if (state == SerieState.Normal) { - return serieData != null && serieData.symbol != null? serieData.symbol : serie.symbol; + return serieData != null && serieData.symbol != null ? serieData.symbol : serie.symbol; } else { @@ -542,16 +542,17 @@ namespace XCharts.Runtime public static bool GetAreaColor(out Color32 color, out Color32 toColor, Serie serie, SerieData serieData, ThemeStyle theme, int index) { - bool fill; - return GetAreaColor(out color, out toColor, out fill, serie, serieData, theme, index); + bool fill, toTop; + return GetAreaColor(out color, out toColor, out fill, out toTop, serie, serieData, theme, index); } public static bool GetAreaColor(out Color32 color, out Color32 toColor, out bool innerFill, - Serie serie, SerieData serieData, ThemeStyle theme, int index) + out bool toTop, Serie serie, SerieData serieData, ThemeStyle theme, int index) { color = ChartConst.clearColor32; toColor = ChartConst.clearColor32; innerFill = false; + toTop = true; var state = GetSerieState(serie, serieData); var stateStyle = GetStateStyle(serie, serieData, state); if (stateStyle == null) @@ -559,6 +560,7 @@ namespace XCharts.Runtime var areaStyle = GetAreaStyle(serie, serieData); if (areaStyle == null || !areaStyle.show) return false; innerFill = areaStyle.innerFill; + toTop = areaStyle.toTop; GetColor(ref color, areaStyle.color, serie.itemStyle.color, areaStyle.opacity, theme, index); GetColor(ref toColor, areaStyle.toColor, color, areaStyle.opacity, theme, index); switch (state) @@ -584,6 +586,7 @@ namespace XCharts.Runtime if (stateStyle.areaStyle.show) { innerFill = stateStyle.areaStyle.innerFill; + toTop = stateStyle.areaStyle.toTop; GetColor(ref color, stateStyle.areaStyle.color, stateStyle.itemStyle.color, stateStyle.areaStyle.opacity, theme, index); GetColor(ref color, stateStyle.areaStyle.toColor, color, stateStyle.areaStyle.opacity, theme, index); } @@ -679,7 +682,7 @@ namespace XCharts.Runtime if (stateStyle == null) { var symbol = GetSerieSymbol(serie, serieData, SerieState.Normal); - size = symbol.GetSize(serieData == null? null : serieData.data, defaultSize); + size = symbol.GetSize(serieData == null ? null : serieData.data, defaultSize); switch (state) { case SerieState.Emphasis: @@ -693,7 +696,7 @@ namespace XCharts.Runtime else { var symbol = stateStyle.symbol; - size = symbol.GetSize(serieData == null? null : serieData.data, defaultSize); + size = symbol.GetSize(serieData == null ? null : serieData.data, defaultSize); } return size; } @@ -892,7 +895,7 @@ namespace XCharts.Runtime switch (serie.dataSortType) { case SerieDataSortType.Ascending: - serie.context.sortedData.Sort(delegate(SerieData data1, SerieData data2) + serie.context.sortedData.Sort(delegate (SerieData data1, SerieData data2) { var value1 = data1.GetData(1); var value2 = data2.GetData(1); @@ -902,7 +905,7 @@ namespace XCharts.Runtime }); break; case SerieDataSortType.Descending: - serie.context.sortedData.Sort(delegate(SerieData data1, SerieData data2) + serie.context.sortedData.Sort(delegate (SerieData data1, SerieData data2) { var value1 = data1.GetData(1); var value2 = data2.GetData(1); diff --git a/Runtime/Serie/SeriesHelper.cs b/Runtime/Serie/SeriesHelper.cs index 6879d39e..85717ee3 100644 --- a/Runtime/Serie/SeriesHelper.cs +++ b/Runtime/Serie/SeriesHelper.cs @@ -106,7 +106,8 @@ namespace XCharts.Runtime break; } } - if (ChartHelper.IsClearColor(destSerie.markColor)) + var itemStyle = SerieHelper.GetItemStyle(destSerie, destSerieData, SerieState.Normal); + if (ChartHelper.IsClearColor(itemStyle.markColor)) { Color32 color, toColor; SerieHelper.GetItemColor(out color, out toColor, destSerie, destSerieData, chart.theme, index, SerieState.Normal); @@ -114,7 +115,7 @@ namespace XCharts.Runtime } else { - return destSerie.markColor; + return itemStyle.markColor; } } @@ -345,7 +346,7 @@ namespace XCharts.Runtime if ((isPolar && serie.polarIndex != axisIndex) || (!isPolar && serie.yAxisIndex != axisIndex) || !serie.show) continue; - var updateDuration = serie.animation.enable?serie.animation.dataChangeDuration : 0; + var updateDuration = serie.animation.enable ? serie.animation.dataChangeDuration : 0; var unscaledTime = serie.animation.unscaledTime; if (isPercentStack && SeriesHelper.IsPercentStack<Bar>(series, serie.serieName)) { @@ -354,7 +355,7 @@ namespace XCharts.Runtime } else { - var showData = serie.GetDataList(filterByDataZoom?chart.GetXDataZoomOfSerie(serie) : null); + var showData = serie.GetDataList(filterByDataZoom ? chart.GetXDataZoomOfSerie(serie) : null); if (serie is Candlestick || serie is SimplifiedCandlestick) { foreach (var data in showData) @@ -370,9 +371,9 @@ namespace XCharts.Runtime var performanceMode = serie.IsPerformanceMode(); foreach (var data in showData) { - var currData = performanceMode? data.GetData(yValue?1 : 0, inverse): + var currData = performanceMode ? data.GetData(yValue ? 1 : 0, inverse) : data.GetCurrData(yValue ? 1 : 0, updateDuration, unscaledTime, inverse); - if (!serie.IsIgnoreValue(currData)) + if (!serie.IsIgnoreValue(data, currData)) { if (currData > max) max = currData; if (currData < min) min = currData; @@ -394,7 +395,7 @@ namespace XCharts.Runtime if ((isPolar && serie.polarIndex != axisIndex) || (!isPolar && serie.yAxisIndex != axisIndex) || !serie.show) continue; - var showData = serie.GetDataList(filterByDataZoom?chart.GetXDataZoomOfSerie(serie) : null); + var showData = serie.GetDataList(filterByDataZoom ? chart.GetXDataZoomOfSerie(serie) : null); if (SeriesHelper.IsPercentStack<Bar>(series, serie.stack)) { for (int j = 0; j < showData.Count; j++) @@ -418,7 +419,7 @@ namespace XCharts.Runtime currData = yValue ? showData[j].GetData(1) : showData[j].GetData(0); } if (inverse) currData = -currData; - if (!serie.IsIgnoreValue(currData)) + if (!serie.IsIgnoreValue(showData[j], currData)) _serieTotalValueForMinMax[j] = _serieTotalValueForMinMax[j] + currData; } } diff --git a/Runtime/Widgets/ProgressBar.cs b/Runtime/Widgets/ProgressBar.cs deleted file mode 100644 index 8efac8a0..00000000 --- a/Runtime/Widgets/ProgressBar.cs +++ /dev/null @@ -1,51 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; -using XUGL; - -namespace XCharts.Runtime -{ - [ExecuteInEditMode] - [RequireComponent(typeof(RectTransform))] - [DisallowMultipleComponent] - public class ProgressBar : BaseChart - { - [SerializeField][Range(0f, 1f)] private float m_Value = 0.5f; - [SerializeField] private Color m_BackgroundColor = new Color32(255, 233, 233, 255); - [SerializeField] private Color m_StartColor = Color.blue; - [SerializeField] private Color m_EndColor = Color.red; - [SerializeField] private float[] m_CornerRadius = new float[] { 0, 0, 0, 0 }; - - public float value { get { return m_Value; } set { m_Value = value; SetVerticesDirty(); } } - public Color32 backgroundColor { get { return m_BackgroundColor; } set { m_BackgroundColor = value; SetVerticesDirty(); } } - public Color32 startColor { get { return m_StartColor; } set { m_StartColor = value; SetVerticesDirty(); } } - public Color32 endColor { get { return m_EndColor; } set { m_EndColor = value; SetVerticesDirty(); } } - public float[] cornerRadius { get { return m_CornerRadius; } set { m_CornerRadius = value; SetVerticesDirty(); } } - -#if UNITY_EDITOR - protected override void Reset() - { - base.Reset(); - var title = GetOrAddChartComponent<Title>(); - title.text = "ProgressBar"; - title.show = false; - SetSize(580, 4); - RemoveData(); - } -#endif - - protected override void OnDrawPainterBase(VertexHelper vh, Painter painter) - { - vh.Clear(); - var centerPos = new Vector3(chartPosition.x + m_ChartWidth / 2, chartPosition.y + m_ChartHeight / 2); - UGL.DrawRoundRectangle(vh, centerPos, m_ChartWidth, m_ChartHeight, m_BackgroundColor, m_BackgroundColor, - 0, m_CornerRadius, true); - - var valueWidth = m_Value * m_ChartWidth; - var valuePos = new Vector3(chartPosition.x + valueWidth / 2, centerPos.y); - var endColor = Color.Lerp(m_StartColor, m_EndColor, m_Value); - UGL.DrawRoundRectangle(vh, valuePos, valueWidth, m_ChartHeight, m_StartColor, endColor, 0, - m_CornerRadius, true); - } - - } -} \ No newline at end of file diff --git a/Runtime/XCharts.Runtime.asmdef b/Runtime/XCharts.Runtime.asmdef index aa9babc9..64609360 100644 --- a/Runtime/XCharts.Runtime.asmdef +++ b/Runtime/XCharts.Runtime.asmdef @@ -1,13 +1,13 @@ { "name": "XCharts.Runtime", - "references": [ - ], - "optionalUnityReferences": [], + "references": [], "includePlatforms": [], "excludePlatforms": [], "allowUnsafeCode": false, "overrideReferences": false, "precompiledReferences": [], "autoReferenced": true, - "defineConstraints": [] + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false } \ No newline at end of file diff --git a/Runtime/XUGL/UGL.cs b/Runtime/XUGL/UGL.cs index 92de53bb..b35a9820 100644 --- a/Runtime/XUGL/UGL.cs +++ b/Runtime/XUGL/UGL.cs @@ -1323,7 +1323,8 @@ namespace XUGL float smoothness, int gradientType = 0, bool isYAxis = false) { if (radius == 0) return; - if (gap > 0 && Mathf.Abs(toDegree - startDegree) >= 360) gap = 0; + var isCircle = Mathf.Abs(toDegree - startDegree) >= 360; + if (gap > 0 && isCircle) gap = 0; radius -= borderWidth; smoothness = (smoothness < 0 ? 2f : smoothness); int segments = (int) ((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness); @@ -1363,7 +1364,7 @@ namespace XUGL if (realToAngle < realStartAngle) realToAngle = realStartAngle; p2 = UGLHelper.GetPos(center, radius, realStartAngle); } - if (needBorder) + if (needBorder && !isCircle) { borderDiff = borderLineWidth / Mathf.Sin(halfAngle); realCenter += borderDiff * middleDire; @@ -1514,6 +1515,7 @@ namespace XUGL insideRadius += borderWidth; smoothness = smoothness < 0 ? 2f : smoothness; Vector3 p1, p2, p3, p4, e1, e2; + var isCircle = Mathf.Abs(toDegree - startDegree) >= 360; var needBorder = borderWidth != 0; var needSpace = gap != 0; var diffAngle = Mathf.Abs(toDegree - startDegree) * Mathf.Deg2Rad; @@ -1581,7 +1583,7 @@ namespace XUGL p2 = UGLHelper.GetPos(center, outsideRadius, realStartOutAngle, false); e2 = UGLHelper.GetPos(center, outsideRadius, realToOutAngle, false); } - if (needBorder) + if (needBorder && !isCircle) { var borderDiff = borderWidth / Mathf.Sin(halfAngle); realCenter += Mathf.Abs(borderDiff) * middleDire; diff --git a/package.json b/package.json index 1a863972..967bd128 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "com.monitor1394.xcharts", "displayName": "XCharts", - "version": "3.5.0", - "date": "20221201", - "checkdate": "20221101", + "version": "3.6.0", + "date": "20230401", + "checkdate": "20230401", "desc": "如果 XCharts 对您有帮助,希望您能在 Github 上点 Star 支持,非常感谢!", "unity": "2018.3", "description": "A charting and data visualization library for Unity.",