@@ -298,7 +298,7 @@ std::vector<Expression::Point> parseData(const Expression::List & dataList, Layo
298
298
Expression::List temp2 = p2.asList ();
299
299
300
300
if ( temp1[0 ].isHeadNumber () && temp1[1 ].isHeadNumber ()
301
- && temp1 [0 ].isHeadNumber () && temp1 [1 ].isHeadNumber () )
301
+ && temp2 [0 ].isHeadNumber () && temp2 [1 ].isHeadNumber () )
302
302
{
303
303
double x1 = temp1[0 ].head ().asNumber ();
304
304
double y1 = temp1[1 ].head ().asNumber ();
@@ -316,7 +316,7 @@ std::vector<Expression::Point> parseData(const Expression::List & dataList, Layo
316
316
317
317
318
318
// Can now safely check any and all remaining points in data list
319
- for (auto exp : dataList) {
319
+ for (auto & exp : dataList) {
320
320
// Each Data entry must a List of 2 Numbers or error
321
321
if (exp.isHeadList () && (exp.asList ().size () == 2 )) {
322
322
if (exp.asList ()[0 ].isHeadNumber () && exp.asList ()[1 ].isHeadNumber ()) {
@@ -388,7 +388,7 @@ Expression::List makeBoundBox(LayoutParams & params){
388
388
// Pull struct data into local variables
389
389
double xMax = params.xMax ; double yMax = params.yMax ;
390
390
double xMin = params.xMin ; double yMin = params.yMin ;
391
- double xMid = params.xMid ; double yMid = params.yMid ;
391
+ // double xMid = params.xMid; double yMid = params.yMid;
392
392
393
393
// Top border Line: ( (xMin, yMax) (xMax, yMax) )
394
394
Expression topLine = makeLine (xMin, yMax, xMax, yMax, 0 );
@@ -405,15 +405,15 @@ Expression::List makeBoundBox(LayoutParams & params){
405
405
Expression::List results = { topLine, bottomLine, leftLine, rightLine };
406
406
407
407
// Draw X Axis?
408
- if ( (yMin < 0 ) && (0 < yMax) ){
409
- Expression xAxisLine = makeLine (xMin, yMid , xMax, yMid , 0 );
408
+ if ( (yMin < 0 ) && (0 < yMax) ){
409
+ Expression xAxisLine = makeLine (xMin, 0 , xMax, 0 , 0 );
410
410
results.push_back (xAxisLine);
411
411
params.xAxis = true ;
412
412
}
413
413
414
414
// Draw Y Axis?
415
415
if ( (xMin < 0 ) && (0 < xMax) ){
416
- Expression yAxisLine = makeLine (xMid , yMin, xMid , yMax, 0 );
416
+ Expression yAxisLine = makeLine (0 , yMin, 0 , yMax, 0 );
417
417
results.push_back (yAxisLine);
418
418
params.yAxis = true ;
419
419
}
@@ -531,27 +531,31 @@ Expression::List processOptions(const Expression::List & options, const LayoutPa
531
531
return results;
532
532
};
533
533
534
- Expression::List makeTickLabels (const LayoutParams & params ){
534
+ Expression::List makeTickLabels (const LayoutParams & oldParams, const LayoutParams & newParams ){
535
535
536
536
// Pull struct data into local variables
537
- double xMax = params .xMax ; double yMax = params .yMax ;
538
- double xMin = params .xMin ; double yMin = params .yMin ;
539
- double xOff = params .D ; double yOff = params .C ;
537
+ double xMax = newParams .xMax ; double yMax = newParams .yMax ;
538
+ double xMin = newParams .xMin ; double yMin = newParams .yMin ;
539
+ double xOff = newParams .D ; double yOff = newParams .C ;
540
540
541
- double scale = params .txtScale ;
541
+ double scale = newParams .txtScale ;
542
542
543
- std::ostringstream outStream;
544
- outStream << " \" " << std::setprecision (2 ) << xMax << " \" " ;
545
- std::string xTop = outStream.str ();
543
+ // Label values should be unscaled input values, but use scaled values for placing
544
+ std::ostringstream outStream1;
545
+ outStream1 << std::setprecision (2 ) << oldParams.xMax ;
546
+ std::string xTop = outStream1.str ();
546
547
547
- outStream << " \" " << std::setprecision (2 ) << xMin << " \" " ;
548
- std::string xBot = outStream.str ();
548
+ std::ostringstream outStream2;
549
+ outStream2 << std::setprecision (2 ) << oldParams.xMin ;
550
+ std::string xBot = outStream2.str ();
549
551
550
- outStream << " \" " << std::setprecision (2 ) << yMax << " \" " ;
551
- std::string yRight = outStream.str ();
552
+ std::ostringstream outStream3;
553
+ outStream3 << std::setprecision (2 ) << oldParams.yMax ;
554
+ std::string yRight = outStream3.str ();
552
555
553
- outStream << " \" " << std::setprecision (2 ) << yMin << " \" " ;
554
- std::string yLeft = outStream.str ();
556
+ std::ostringstream outStream4;
557
+ outStream4 << std::setprecision (2 ) << oldParams.yMin ;
558
+ std::string yLeft = outStream4.str ();
555
559
556
560
Expression xTopLabel = makeText (xTop, xMin - xOff, yMax, scale, 0.0 );
557
561
Expression xBottomLabel = makeText (xBot, xMin - xOff, yMin, scale, 0.0 );
@@ -656,7 +660,7 @@ Expression::List Expression::makeDiscretePlot(const List & data, const List & op
656
660
}
657
661
658
662
/* --- Make the Tick Mark Text Labels ---*/
659
- List labels = makeTickLabels (outParams);
663
+ List labels = makeTickLabels (params, outParams);
660
664
for (auto & item : labels) {
661
665
results.push_back (item);
662
666
}
0 commit comments