Skip to content

Commit 20c2655

Browse files
committed
fix simple chart example
1 parent 69a967b commit 20c2655

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

docs/source/guides/escape-hatches/_examples/super_simple_chart/super-simple-chart.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,9 @@ function makePath(props, domain, data, options) {
4848
const getSvgX = (x) => ((x - xMin) / (xMax - xMin)) * width;
4949
const getSvgY = (y) => height - ((y - yMin) / (yMax - yMin)) * height;
5050

51-
let pathD = "M " + getSvgX(data[0].x) + " " + getSvgY(data[0].y) + " ";
52-
pathD += data.map((point, i) => {
53-
return "L " + getSvgX(point.x) + " " + getSvgY(point.y) + " ";
54-
});
51+
let pathD =
52+
`M ${getSvgX(data[0].x)} ${getSvgY(data[0].y)} ` +
53+
data.map(({ x, y }, i) => `L ${getSvgX(x)} ${getSvgY(y)}`).join(" ");
5554

5655
return html`<path
5756
d="${pathD}"

src/idom/web/module.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def module_from_template(
9393
9494
This approach is not recommended for use in a production setting because the
9595
framework templates may use unpinned dependencies that could change without
96-
warning.cIt's best to author a module adhering to the
96+
warning. It's best to author a module adhering to the
9797
:ref:`Custom Javascript Component` interface instead.
9898
9999
**Templates**
@@ -123,8 +123,7 @@ def module_from_template(
123123
elements must be changed on each render. See :issue:`461` for more info.
124124
"""
125125
template_name, _, template_version = template.partition("@")
126-
if template_version:
127-
template_version = "@" + template_version
126+
template_version = "@" + template_version if template_version else ""
128127

129128
# We do this since the package may be any valid URL path. Thus we may need to strip
130129
# object parameters or query information so we save the resulting template under the

0 commit comments

Comments
 (0)