MCPcopy
hub / github.com/chartjs/Chart.js / draw

Method draw

src/elements/element.bar.js:179–201  ·  view source on GitHub ↗
(ctx)

Source from the content-addressed store, hash-verified

177 }
178
179 draw(ctx) {
180 const {inflateAmount, options: {borderColor, backgroundColor}} = this;
181 const {inner, outer} = boundingRects(this);
182 const addRectPath = hasRadius(outer.radius) ? addRoundedRectPath : addNormalRectPath;
183
184 ctx.save();
185
186 if (outer.w !== inner.w || outer.h !== inner.h) {
187 ctx.beginPath();
188 addRectPath(ctx, inflateRect(outer, inflateAmount, inner));
189 ctx.clip();
190 addRectPath(ctx, inflateRect(inner, -inflateAmount, outer));
191 ctx.fillStyle = borderColor;
192 ctx.fill('evenodd');
193 }
194
195 ctx.beginPath();
196 addRectPath(ctx, inflateRect(inner, inflateAmount));
197 ctx.fillStyle = backgroundColor;
198 ctx.fill();
199
200 ctx.restore();
201 }
202
203 inRange(mouseX, mouseY, useFinalPosition) {
204 return inRange(this, mouseX, mouseY, useFinalPosition);

Callers

nothing calls this directly

Calls 3

boundingRectsFunction · 0.85
hasRadiusFunction · 0.85
inflateRectFunction · 0.85

Tested by

no test coverage detected