Skip to content

Commit d8087c0

Browse files
committed
Fix bug I introduced where single graphs won't render
1 parent a194a7f commit d8087c0

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

media/js/src/JXGBoard.jsx

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -677,38 +677,40 @@ export default class JXGBoard extends React.Component {
677677
boundingBox = calculateBoundingBox(0, 0, 1000, 2500);
678678
}
679679

680-
this.board2 = JXG.JSXGraph.initBoard(
681-
this.id + '-2', {
682-
axis: true,
683-
defaultAxes: {
684-
x: {
685-
name: xLabel,
686-
label: {
687-
offset: [400, 0]
680+
if (isJointGraph(this.props.gType)) {
681+
this.board2 = JXG.JSXGraph.initBoard(
682+
this.id + '-2', {
683+
axis: true,
684+
defaultAxes: {
685+
x: {
686+
name: xLabel,
687+
label: {
688+
offset: [400, 0]
689+
},
690+
withLabel: xLabel ? true : false,
691+
ticks: xTicks,
692+
layer: 9
688693
},
689-
withLabel: xLabel ? true : false,
690-
ticks: xTicks,
691-
layer: 9
694+
y: {
695+
name: yLabel,
696+
label: {
697+
offset: [0, 260]
698+
},
699+
withLabel: yLabel ? true : false,
700+
ticks: yTicks,
701+
layer: 9
702+
}
692703
},
693-
y: {
694-
name: yLabel,
695-
label: {
696-
offset: [0, 260]
697-
},
698-
withLabel: yLabel ? true : false,
699-
ticks: yTicks,
700-
layer: 9
701-
}
702-
},
703-
keepAspectRatio: false,
704-
showCopyright: false,
705-
showZoom: false,
706-
showReload: false,
707-
showNavigation: false,
708-
boundingBox: boundingBox
709-
});
704+
keepAspectRatio: false,
705+
showCopyright: false,
706+
showZoom: false,
707+
showReload: false,
708+
showNavigation: false,
709+
boundingBox: boundingBox
710+
});
710711

711-
this.board2InitObjects = this.board2.numObjects;
712+
this.board2InitObjects = this.board2.numObjects;
713+
}
712714

713715
this.renderJXBoard({
714716
l1SubmissionOffset: getL1SubmissionOffset(this.props.submission),
@@ -739,7 +741,6 @@ export default class JXGBoard extends React.Component {
739741
let math1 = null;
740742
let math2 = null;
741743
let area = null;
742-
let isJointGraph = false;
743744

744745
if (this.props.gType === 9 || this.props.gType === 10) {
745746
area = <AreaDisplay
@@ -755,7 +756,6 @@ export default class JXGBoard extends React.Component {
755756
math1 = getKatexEl(func1);
756757
math2 = getKatexEl(func2);
757758
}
758-
isJointGraph = true;
759759
}
760760

761761
let legend = null;
@@ -778,7 +778,7 @@ export default class JXGBoard extends React.Component {
778778
<>
779779
<div className="col-xl-6">
780780
{this.makeFigure(this.id, math1)}
781-
{isJointGraph && this.makeFigure(this.id + '-2', math2)}
781+
{isJointGraph(this.props.gType) && this.makeFigure(this.id + '-2', math2)}
782782
</div>
783783
{legend}
784784
{area}

media/js/src/graphs/graphTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ import {
7474

7575

7676
export const isJointGraph = function(graphType) {
77-
return [12, 13, 14, 24].includes(graphType);
77+
return [12, 13, 14, 24, 32].includes(graphType);
7878
};
7979

8080
export const graphTypes = [

0 commit comments

Comments
 (0)