Skip to content

Add in some more properties to PlotlyLine. #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/Seaside-Plotly-Core/PlotlyLine.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,41 @@ PlotlyLine class >> spline [
yourself
]

{ #category : #accessing }
PlotlyLine >> color: aColor [

"set the color of the line"

self propertyAt: 'color' put: aColor
]

{ #category : #accessing }
PlotlyLine >> dash: aString [

"aString can be: solid, dot, dash, longdash, dashdot, or longdashdot"

self propertyAt: 'dash' put: aString
]

{ #category : #accessing }
PlotlyLine >> shape: aString [
"aString can be: linear, spline, vhv, hvh, vhv, hv, vh"

self propertyAt: 'shape' put: aString
]

{ #category : #accessing }
PlotlyLine >> smoothing: aNumber [

"aNumber can be between 0 and 1.3. Is only used when the line shape is set to 'spline'"

self propertyAt: 'smoothing' put: aNumber
]

{ #category : #accessing }
PlotlyLine >> width: aNumber [

"The width of the line. aNumber can be greater than or equal to 0."

self propertyAt: 'width' put: aNumber
]
12 changes: 12 additions & 0 deletions src/Seaside-Plotly-Core/PlotlyTrace.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ PlotlyTrace >> dontClipOnAxis [
self clipOnAxis: false
]

{ #category : #configuring }
PlotlyTrace >> line [

^ self propertyAt: 'line' ifAbsentPut: [ PlotlyLine new ]
]

{ #category : #configuring }
PlotlyTrace >> line: aPlotlyLine [

self propertyAt: 'line' put: aPlotlyLine
]

{ #category : #convenience }
PlotlyTrace >> lineAndMarkersMode [

Expand Down
42 changes: 39 additions & 3 deletions src/Seaside-Plotly-Examples/WAPlotlyExamples.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ WAPlotlyExamples class >> initialize [

{ #category : #'rendering-meta' }
WAPlotlyExamples >> examples [
^ OrderedCollection streamContents: [ :s |
(Pragma allNamed: #example in: self class) do: [ :pragma |
s nextPut: pragma method selector ] ]
^ OrderedCollection
streamContents: [ :s |
(Pragma
allNamed: #example in: self class)
do: [ :pragma | s nextPut: pragma method selector ] ]

]

{ #category : #private }
Expand Down Expand Up @@ -257,6 +260,39 @@ WAPlotlyExamples >> scriptExampleHistogramOn: script elementId: elementId [
script << plotly
]

{ #category : #'javascript-examples' }
WAPlotlyExamples >> scriptExampleLineTypeOn: script elementId: elementId [

<example>
| plotly |
plotly := script plotly: elementId.
plotly
data: {
(PlotlyTrace scatter
name: 'Spline series';
showlegend: true;
line: (PlotlyLine new
shape: 'spline';
color: Color lightGray;
dash: 'dot';
yourself);
x: (1 to: 10) asArray;
y: ((1 to: 10) collect: [ :each | 10 atRandom / 2 ]);
yourself). "Color veryLightGray"
(PlotlyTrace scatter
name: 'Linear series';
showlegend: true;
x: (1 to: 10) asArray;
y: ((1 to: 10) collect: [ :each | 10 atRandom / 2 ]);
yourself) };
layout: (PlotlyLayout new
title: (PlotlyText text: 'Line Types');
width: 500 height: 300;
yourself).
plotly config beResponsive.
script << plotly
]

{ #category : #'javascript-examples' }
WAPlotlyExamples >> scriptExamplePieInstantationOn: script elementId: elementId [
<example>
Expand Down