To have the line-plot-series constructors mirror the scatter-plot-series constructors I added 2 new constructors
labeled line plot - Gives labels to each point in the line plot series (Constructor)
from-list.labeled-line-plot(labels :: List<String>, xs :: List<Number>, ys :: List<Number>)
image line plot - Centers images around each point in the line plot series (Constructor)
from-list.image-line-plot :: (images :: List<Image>, xs :: List<Number>, ys :: List<Number>)
New Data Types
StackType - [grouped, absolute, relative, percent].
Describes how bar chart components are displayed together.
TrendlineType - [no-trendline, linear, exponential, polynomial(degree)]
Describes the equation type used to estimate the trenlines of the points in the line-plot-series or scatter-plot-series
PointShape - [circle-shape, regular-polygon-shape(sides, dent)]
Describes the shape of the points in the line-plot-series or scatter-plot-series.
Data Series Methods Implemented
We implemented the following methods.
Line Plot Series:
labels - Adds labels to the points of the line plot series (Method)
line-plot-series.labels(labels :: List<String>)
image-labels - Centers images around each point in the line plot series (Method)
line-plot-series.image-labels(images :: List<Image>)
curved - Curves the lines between the points of the line plot series
line-plot-series.curved(curved :: Boolean)
linewidth - Changes the line width of the lines between the points of the line plot series
line-plot-series.linewidth(width :: Number)
dashed-line - Makes the lines between the points of the line plot series dashed instead of solid
line-plot-series.dashed-line(dashed :: Boolean)
dashline-style - Makes the lines dashed with a style with an on-and-off pattern for dashed lines. For example: [list: 5, 1, 3] will repeat a 5-length dash, a 1-length gap, a 3-length dash, a 5-length gap, a 1-length dash, and a 3-length gap.
line-plot-series.dashline-style(style :: List<Number>)
point-shape - Gives a new shape for each point. Either a circle or a regular polygon with a specified dent inward or outward.
line-plot-series .point-shape(shape :: PointShape)
point-size - Gives a new size for each point in the data series.
line-plot-series.point-size(point-size :: Number)
trendline-type - Creates a new trendline using the data points with the given type of equation.
line-plot-series.trendline-type(type :: TrendlineType)
trendline-color - Gives the new trendline a new color.
line-plot-series.trendline-color(color :: Color)
trendline-width - Gives the new trendline a new line width.
line-plot-series.trendline-width(width :: Number)
12.trendline-opacity - Gives the new trendline a new opacity.
line-plot-series.trendline-opacity(opacity :: Number)
Scatter Plot Series:
labels - Adds labels to the points of the scatter plot series (Method)
scatter-plot-series.labels(labels :: List<String>)
image-labels - Centers images around each point in the scatter plot series (Method)
scatter-plot-series.image-labels(images :: List<Image>)
point-shape - Gives a new shape for each point. Either a circle or a regular polygon with a specified dent inward or outward.
scatter-plot-series .point-shape(shape :: PointShape)
trendline-type - Creates a new trendline using the data points with the given type of equation.
scatter-plot-series.trendline-type(type :: TrendlineType)
trendline-color - Gives the new trendline a new color.
scatter-plot-series.trendline-color(color :: Color)
trendline-width - Gives the new trendline a new line width.
scatter-plot-series.trendline-width(width :: Number)
trendline-opacity - Gives the new trendline a new opacity.
scatter-plot-series.trendline-opacity(opacity :: Number)
Pie Chart Series:
explode - Explodes the pie chart slices by the specified offsets.
pie-chart-series.explode(offsets :: List<Number>)
colors - Colors the pie chart slices by the specified colors.
pie-chart-series.colors(colors :: List<Color>)
threeD - Makes the pie chart 3 dimensional instead of 2 dimensional
pie-chart-series.threeD(three-d :: Boolean)
piehole - Creates a hole in the middle of the pie chart thus effectively making a donut pie chart.
pie-chart-series.piehole(hole :: Number)
rotate - Rotates the place where the starting slice is created from.
pie-chart-series.rotate(angle :: Number)
collapse-threshold - Collapses slices under threshold into a combined other slice.
`pie-chart-series.collapse-threshold(threshold :: Number)
Histogram Series:
labels - Adds labels to the boxes of the histogram series (Method)
histogram-series.labels(labels :: List<String>)
color - Gives the histogram boxes a new color.
histogram-series.color(color :: Color)
Box Plot Series:
1.labels - Adds labels to the boxes of the box-plot (Method)
box-plot-series.labels(labels :: List<String>)
color - Gives the boxes in the box-plot a new color.
box-plot-series.color(color :: Color)
Plot Chart Window:
gridlines-minspacing - Manually sets the minimum spacing between major gridlines.
plot-chart-window.gridlines-minspacing(min-spacing :: Number)
gridlines-color - Manually sets the color of the major gridlines.
plot-chart-window.gridlines-color(color :: Color)
show-minor-gridlines - Displays the minor gridlines alongside the major gridlines.
plot-chart-window.show-minor-gridlines(show :: Boolean)
minor-gridlines-minspacing - Manually sets the minimum spacing between minor gridlines.
plot-chart-window.minor-gridlines-minspacing(min-spacing :: Number)
.minor-gridlines-color - Manually sets the color of the minor gridlines.
plot-chart-window.minor-gridlines-color(color :: Color)
select-multiple - Allows the user to select multiple points at a time
plot-chart-window.select-multiple(multiple :: Boolean)
Chart Window (ALL):
.background-color - Manually sets the background color of the chart window.
chart-window.background-color(color :: Color)
.border-size - Manually sets the border size of the chart window.
chart-window.border-size(border :: Number)
*.border-color - Manually sets the border color of the chart window.
chart-window.border-color(color :: Color)
Issues
Render-charts does not work as intended with many of the new methods implemented. For some, like .curved or .image-labels the methods just do nothing. Other methods like .linewidth and .dashline-style seem to affect every DataSeries of the same type! Overall just funky behavior.
The image-label constructors and methods may be a bit unstable since they are dependent on directly grabbing the children of the SVG dom and their location can change. I know this was mentioned in a comment in the code but I just thought it was worth re-mentioning here since it did happen.
Notable Code Changes
This is a continuation of https://github.com/brownplt/code.pyret.org/pull/369 mainly focused on fleshing out the methods of the other chart series. Most of the methods changed below have already been documented at https://github.com/brownplt/pyret-docs/pull/63 if you want to see the documentation there.
New Constructors
To have the line-plot-series constructors mirror the scatter-plot-series constructors I added 2 new constructors
labeled line plot - Gives labels to each point in the line plot series (Constructor)
from-list.labeled-line-plot(labels :: List<String>, xs :: List<Number>, ys :: List<Number>)
image line plot - Centers images around each point in the line plot series (Constructor)
from-list.image-line-plot :: (images :: List<Image>, xs :: List<Number>, ys :: List<Number>)
New Data Types
Data Series Methods Implemented
We implemented the following methods.
Line Plot Series:
labels - Adds labels to the points of the line plot series (Method)
line-plot-series.labels(labels :: List<String>)
image-labels - Centers images around each point in the line plot series (Method)
line-plot-series.image-labels(images :: List<Image>)
curved - Curves the lines between the points of the line plot series
line-plot-series.curved(curved :: Boolean)
linewidth - Changes the line width of the lines between the points of the line plot series
line-plot-series.linewidth(width :: Number)
dashed-line - Makes the lines between the points of the line plot series dashed instead of solid
line-plot-series.dashed-line(dashed :: Boolean)
dashline-style - Makes the lines dashed with a style with an on-and-off pattern for dashed lines. For example: [list: 5, 1, 3] will repeat a 5-length dash, a 1-length gap, a 3-length dash, a 5-length gap, a 1-length dash, and a 3-length gap.
line-plot-series.dashline-style(style :: List<Number>)
point-shape - Gives a new shape for each point. Either a circle or a regular polygon with a specified dent inward or outward.
line-plot-series .point-shape(shape :: PointShape)
point-size - Gives a new size for each point in the data series.
line-plot-series.point-size(point-size :: Number)
trendline-type - Creates a new trendline using the data points with the given type of equation.
line-plot-series.trendline-type(type :: TrendlineType)
trendline-color - Gives the new trendline a new color.
line-plot-series.trendline-color(color :: Color)
trendline-width - Gives the new trendline a new line width.
line-plot-series.trendline-width(width :: Number)
12.trendline-opacity - Gives the new trendline a new opacity.
line-plot-series.trendline-opacity(opacity :: Number)
Scatter Plot Series:
labels - Adds labels to the points of the scatter plot series (Method)
scatter-plot-series.labels(labels :: List<String>)
image-labels - Centers images around each point in the scatter plot series (Method)
scatter-plot-series.image-labels(images :: List<Image>)
point-shape - Gives a new shape for each point. Either a circle or a regular polygon with a specified dent inward or outward.
scatter-plot-series .point-shape(shape :: PointShape)
trendline-type - Creates a new trendline using the data points with the given type of equation.
scatter-plot-series.trendline-type(type :: TrendlineType)
trendline-color - Gives the new trendline a new color.
scatter-plot-series.trendline-color(color :: Color)
trendline-width - Gives the new trendline a new line width.
scatter-plot-series.trendline-width(width :: Number)
trendline-opacity - Gives the new trendline a new opacity.
scatter-plot-series.trendline-opacity(opacity :: Number)
Pie Chart Series:
explode - Explodes the pie chart slices by the specified offsets.
pie-chart-series.explode(offsets :: List<Number>)
colors - Colors the pie chart slices by the specified colors.
pie-chart-series.colors(colors :: List<Color>)
threeD - Makes the pie chart 3 dimensional instead of 2 dimensional
pie-chart-series.threeD(three-d :: Boolean)
piehole - Creates a hole in the middle of the pie chart thus effectively making a donut pie chart.
pie-chart-series.piehole(hole :: Number)
rotate - Rotates the place where the starting slice is created from.
pie-chart-series.rotate(angle :: Number)
collapse-threshold - Collapses slices under threshold into a combined other slice. `pie-chart-series.collapse-threshold(threshold :: Number)
Histogram Series:
labels - Adds labels to the boxes of the histogram series (Method)
histogram-series.labels(labels :: List<String>)
color - Gives the histogram boxes a new color.
histogram-series.color(color :: Color)
Box Plot Series:
1.labels - Adds labels to the boxes of the box-plot (Method)
box-plot-series.labels(labels :: List<String>)
box-plot-series.color(color :: Color)
Plot Chart Window:
gridlines-minspacing - Manually sets the minimum spacing between major gridlines.
plot-chart-window.gridlines-minspacing(min-spacing :: Number)
gridlines-color - Manually sets the color of the major gridlines.
plot-chart-window.gridlines-color(color :: Color)
show-minor-gridlines - Displays the minor gridlines alongside the major gridlines.
plot-chart-window.show-minor-gridlines(show :: Boolean)
minor-gridlines-minspacing - Manually sets the minimum spacing between minor gridlines.
plot-chart-window.minor-gridlines-minspacing(min-spacing :: Number)
.minor-gridlines-color - Manually sets the color of the minor gridlines.
plot-chart-window.minor-gridlines-color(color :: Color)
select-multiple - Allows the user to select multiple points at a time
plot-chart-window.select-multiple(multiple :: Boolean)
Chart Window (ALL):
.background-color - Manually sets the background color of the chart window.
chart-window.background-color(color :: Color)
.border-size - Manually sets the border size of the chart window.
chart-window.border-size(border :: Number)
*.border-color - Manually sets the border color of the chart window.
chart-window.border-color(color :: Color)
Issues