翻譯|使用教程|編輯:楊鵬連|2021-05-07 11:05:25.557|閱讀 300 次
概述:本文詳細介紹了LightningChart JS從2.2.1版到3.0.0版的遷移指南。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
LightningChart JS是Web上性能最高的圖表庫具有出色的執行性能 - 使用高數據速率同時監控數十個數據源。 GPU加速和WebGL渲染確保您的設備的圖形處理器得到有效利用,從而實現高刷新率和流暢的動畫。非常適合用于貿易,工程,航空航天,醫藥和其他領域的應用。
ChartXY.addAxisX/Y
addAxis方法的參數已經改變。如果你以前沒有提供參數,那么使用方法
沒有改變。
在3.0之前,有一個單一的addTop布爾參數。遷移到3.0后,要像下面這樣遷移它。
3.0之前的用法:
Chart.addAxisX(true)3.0之后的用法:
Chart.addAxisX({ opposite: true })規模變化
UI元素的自定義比例變化
涉及到以下方法。
- Chart.addUIElement
- Chart.addLegendBox
- Dashboard.addUIElement
- Dashboard.addLegendBox
變化只適用于第二個參數,刻度。這個參數過去和現在都是可選的--如果你
如果你沒有使用它,或者提供了未定義的參數,就沒有必要進行修改。
在軸值上定位UI元素
以前版本的語法:
chart.addUIElement(UIElementBuilders.TextBox, { x: xAxis.scale, y: yAxis.scale })LCJS v3.0的語法:
chart.addUIElement(UIElementBuilders.TextBox, { x: xAxis, y: yAxis })將UI元素定位在不同的X和Y刻度上
以前版本的語法
chart.addUIElement(UIElementBuilders.TextBox, { x: chart.uiScale.x, y: chart.pixelScale.y })LCJS v3.0的語法
chart.addUIElement(UIElementBuilders.TextBox, { x: chart.uiScale, y: chart.pixelScale })刪除了Axis屬性
屬性 遷移說明
getTickStyle() 默認的軸刻度樣式可以通過以下方式查詢
Themes.dark.numericTickStrategy
plottingScale 用軸本身代替,見 "在軸值上定位UI
元素在軸值上的位置"
heightScale 使用軸本身,見 "在軸的數值上定位UI元素"。
元素在軸值上的定位"
Axis.scale
Axis.scale屬性已被刪除。
屬性 遷移說明
Axis.scale.getInnerStart() Axis.getInterval().start
Axis.scale.getInnerEnd() Axis.getInterval().end
Axis.scale.getInnerInterval() Math.abs(Axis.getInterval().end-)
Axis.getInterval().start)
Axis.scale.getPixelSize()
沒有直接替換。如果你從Arction的例子中復制了這個用法
如果你從Arction的例子中復制了用法,請參考該例子以了解最新用法。
最新的用法。
Axis.scale.getCellSize()
沒有直接替換。如果你從Arction的例子中復制了這個用法從Arction的例子中復制了
將軸坐標翻譯成其他坐標系,以及其他方式的翻譯
translatePoint現在接受Axis對象,而不是以前使用Axis.scale的方式。
將軸坐標轉換為像素的用法示例。
const pixelLocation = translatePoint(
// axis coordinate.
{ x: 116.9, y: 26.4 },
{
x: chart.getDefaultAxisX(),
y: chart.getDefaultAxisY(),
},
chart.pixelScale
)
刪除了Scale API
涉及到以下屬性
- Chart.uiScale
- Chart.pixelScale
- Chart.engine.scale
- 儀表盤.uiScale
- 儀表盤.引擎.比例
- Series.scale
所有這些屬性的API已經被移除。
屬性遷移說明
uiScale getInnerStart()等于0,getInnerEnd()等于100。
Series.scale 使用Axis.getInterval()代替。
getCellSize() 沒有直接替換。如果你從Arction的例子中復制了這個用法,如果你從Arction的例子中復制了用法,請參考該例子以了解最新用法。
getPixelSize() 沒有直接替換。如果你從Arction的例子中復制了這個用法
如果你從Arction的例子中復制了用法.
數據模式(DataPattern)
DataPattern API的語法已經改變。現在它使用了更靈活的對象參數。新的
選項 regularProgressiveStep 已被添加到更多特定應用的優化中。
LCJS v2.2.1:
const lineSeries = ChartXY.addLineSeries({ dataPattern: DataPatterns.horizontalProgressive })LCJS v3.0.0:
const lineSeries = ChartXY.addLineSeries({ dataPattern: { // pattern: 'ProgressiveX' => 每個連續的數據點有 增加的X坐標。 pattern: 'ProgressiveX', // regularProgressiveStep: false => 每個連續的數據點之間的X步長是不規則的。 連續的數據點之間的X步長是不規則的。 regularProgressiveStep: false, } })在以前的版本中,dataPattern還選擇了解決離鼠標最近的數據點的基礎
const lineSeries = ChartXY.addLineSeries() .setCursorSolveBasis('nearest-x')支持的值是'nearest-x'、'nearest-y'和'nearest'。
圖例框的變化
圖例框標題
以前的行為。LegendBox的標題被自動設置為與圖表的標題一致
新的行為。默認情況下,LegendBox的標題是空的。用LegendBox.setTitle( 'My title')來設置。
LegendBox.add參數變化
點擊時處置
以前的語法。LegendBox.add( component, false )
3.0的語法。LegendBox.add( component, { disposeOnClick: false } )
標簽
以前的語法。LegendBox.add( component, undefined, 'Group tag' )
3.0: 沒有直接替換。要給LegendBox添加標題,請使用LegendBox.setTitle('Group tag')
建設者
以前的語法。LegendBox.add( component, undefined, undefined, entryBuilder )
3.0的語法。LegendBox.add( component, { builder: entryBuilder } )
對LegendBoxEntries樣式的修改
以前的語法
const entries = LegendBox.add( chart) entries.forEach(entry => entry.setTextFillStyle( ...))3.0的語法。
LegendBox.add( chart).setEntries( entry => entry.setTextFillStyle( ... ) )UILegendBoxPanel
add()
系列或其他可附件不再能直接添加到 legendBox 面板。只有整個圖表。
或包含一個或多個圖表的儀表板可以被添加。
標題
legendBox面板不再有一個內置的標題組件。一個自定義的標題可以用
UILegendBoxPanel.addUIElement
每個附加的圖表都有自己內部創建的LegendBox,每個LegendBox也有一個可配置的標題
移除的方法
- UILegendBoxPanel.setTitle
- UILegendBoxPanel.getTitle
- UILegendBoxPanel.setTitleFillStyle
- UILegendBoxPanel.getTitleFillStyle
- UILegendBoxPanel.setTitleFont
- UILegendBoxPanel.getTitleFont
SetEntries()
圖例框條目現在被分組到獨立的圖例框中,按圖表分組。要訪問
要訪問圖例框面板內的圖例框條目,請使用UILegendBoxPanel.setLegendBoxes。
自定義刻度變化
CustomTick.setTopPadding已改名為setTickLabelPadding
PointableTextBox重命名為UIPointableTextBox
CustomTick.setPaddingBottom和CustomTick.setSidePaddings已被刪除。它們可以通過CustomTick Marker background(如果刻度線有背景)來訪問。
CustomTick.setMarker((tickMarker: UIPointableTextBox) => tickMarker .setBackground((background) => background .setPadding({ // 填充底部 bottom:10, // 側面的填充物 left: 20, right: 20 }) ) )一般性修改
- 刪除了PointSeriesOptions3D.pointShape。使用PointSeries3D.setPointStyle代替。
- 刪除了PointLineSeriesOptions3D.pointShape。使用PointLineSeries3D.setPointStyle來代替。
- 刪除了Theme.numericTickStrategy3D。請使用Theme.numericTickStrategy代替。
- 刪除了Theme.dateTickStrategy3D。使用Theme.dateTimeTickStrategy代替。
- ResultTable.setFont重命名為setTextFont。
- UITextBox.setFont重命名為setTextFont。
- UICheckBox.setFont重命名為setTextFont。
- LegendBoxEntry.setFont重命名為setTextFont
- setChartBackgroundFillStyle方法改名為setSeriesBackgroundFillStyle
- getChartBackgroundFillStyle方法重命名為getSeriesBackgroundFillStyle
- setChartBackgroundStrokeStyle方法改名為setSeriesBackgroundStrokeStyle
- getChartBackgroundStrokeStyle方法重命名為getSeriesBackgroundStrokeStyle。
- on/offChartBackground...事件方法重命名為on/offSeriesBackground...
- setResultTableFormatter重命名為setCursorResultTableFormatter
- getResultTableFormatter重命名為getCursorResultTableFormatter。
- Theme.chartBackgroundFillStyle重命名為Theme.seriesBackgroundFillStyle。
- Theme.chartBackgroundStrokeStyle重命名為Theme.seriesBackgroundStrokeStyle
如果您對該圖表控件感興趣,歡迎加入圖表控件QQ交流群:740060302
如果你想LightningChart JS應用于商業用途,歡迎。
關注下方的微信公眾號,及時獲取產品最新資訊▼▼▼
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn