MCPcopy
hub / github.com/nhn/tui.chart / makeLineModel

Method makeLineModel

apps/chart/src/component/plot.ts:214–240  ·  view source on GitHub ↗
(
    vertical: boolean,
    position: number,
    {
      color,
      dashSegments = [],
      lineWidth = 1,
    }: { color: string; dashSegments?: number[]; lineWidth?: number },
    sizeWidth?: number,
    xPos = 0
  )

Source from the content-addressed store, hash-verified

212 }
213
214 makeLineModel(
215 vertical: boolean,
216 position: number,
217 {
218 color,
219 dashSegments = [],
220 lineWidth = 1,
221 }: { color: string; dashSegments?: number[]; lineWidth?: number },
222 sizeWidth?: number,
223 xPos = 0
224 ): LineModel {
225 const x = vertical ? crispPixel(position) : crispPixel(xPos);
226 const y = vertical ? crispPixel(0) : crispPixel(position);
227 const width = vertical ? 0 : sizeWidth ?? this.rect.width;
228 const height = vertical ? this.rect.height : 0;
229
230 return {
231 type: 'line',
232 x,
233 y,
234 x2: x + width,
235 y2: y + height,
236 strokeStyle: color,
237 lineWidth,
238 dashSegments,
239 };
240 }
241
242 beforeDraw(painter: Painter) {
243 painter.ctx.strokeStyle = 'rgba(0, 0, 0, 0.05)';

Callers 2

renderLinesMethod · 0.95
renderPlotLineModelsMethod · 0.95

Calls 1

crispPixelFunction · 0.90

Tested by

no test coverage detected