MCPcopy
hub / github.com/apache/echarts / prepareStore

Function prepareStore

src/data/DataStore.ts:132–157  ·  view source on GitHub ↗
(
    store: DataValueChunk[],
    dimIdx: number,
    dimType: DataStoreDimensionType,
    end: number,
    append?: boolean
)

Source from the content-addressed store, hash-verified

130}
131
132function prepareStore(
133 store: DataValueChunk[],
134 dimIdx: number,
135 dimType: DataStoreDimensionType,
136 end: number,
137 append?: boolean
138): void {
139 const DataCtor = dataCtors[dimType || 'float'];
140
141 if (append) {
142 const oldStore = store[dimIdx];
143 const oldLen = oldStore && oldStore.length;
144 if (!(oldLen === end)) {
145 const newStore = new DataCtor(end);
146 // The cost of the copy is probably inconsiderable
147 // within the initial chunkSize.
148 for (let j = 0; j < oldLen; j++) {
149 newStore[j] = oldStore[j];
150 }
151 store[dimIdx] = newStore;
152 }
153 }
154 else {
155 store[dimIdx] = new DataCtor(end);
156 }
157};
158
159/**
160 * Basically, DataStore API keep immutable.

Callers 2

appendValuesMethod · 0.85
_initDataFromProviderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…