// Copyright 2018, University of Colorado Boulder

/**
 * Displays the axis of symmetry for a quadratic.
 *
 * @author Chris Malley (PixelZoom, Inc.)
 */
define( require => {
  'use strict';

  // modules
  const GQColors = require( 'GRAPHING_QUADRATICS/common/GQColors' );
  const GQConstants = require( 'GRAPHING_QUADRATICS/common/GQConstants' );
  const graphingQuadratics = require( 'GRAPHING_QUADRATICS/graphingQuadratics' );
  const Node = require( 'SCENERY/nodes/Node' );
  const Path = require( 'SCENERY/nodes/Path' );
  const Shape = require( 'KITE/Shape' );

  class AxisOfSymmetryNode extends Node {

    /**
     * @param {Property.<Quadratic>} quadraticProperty
     * @param {Graph} graph
     * @param {ModelViewTransform2} modelViewTransform
     * @param {Object} [options]
     */
    constructor( quadraticProperty, graph, modelViewTransform, options ) {

      options = _.extend( {
        color: GQColors.AXIS_OF_SYMMETRY
      }, options );

      const path = new Path( null, {
        stroke: options.color,
        lineWidth: GQConstants.AXIS_OF_SYMMETRY_LINE_WIDTH,
        lineDash: GQConstants.AXIS_OF_SYMMETRY_LINE_DASH
      } );

      assert && assert( !options.children, 'AxisOfSymmetryNode sets children' );
      options.children = [ path ];

      super( options );

      const minY = modelViewTransform.modelToViewY( graph.yRange.max );
      const maxY = modelViewTransform.modelToViewY( graph.yRange.min );

      quadraticProperty.link( quadratic => {
        if ( quadratic.axisOfSymmetry === undefined ) {
          path.shape = null;
        }
        else {
          const x = modelViewTransform.modelToViewX( quadratic.axisOfSymmetry );
          path.shape = new Shape().moveTo( x, minY ).lineTo( x, maxY );
        }
      } );
    }
  }

  return graphingQuadratics.register( 'AxisOfSymmetryNode', AxisOfSymmetryNode );
} );
@@ -338,24 +338,95 @@
 nstants' );%0A
+  const GQSymbols = require( 'GRAPHING_QUADRATICS/common/GQSymbols' );%0A
   const grap
@@ -603,36 +603,249 @@
 nst 
-Shape = require( 'KITE/Shape
+PhetFont = require( 'SCENERY_PHET/PhetFont' );%0A  const RichText = require( 'SCENERY/nodes/RichText' );%0A  const Shape = require( 'KITE/Shape' );%0A  const StringUtils = require( 'PHETCOMMON/util/StringUtils' );%0A  const Util = require( 'DOT/Util
 ' );
@@ -1220,16 +1220,37 @@
 SYMMETRY
+,%0A        decimals: 2
 %0A      %7D
@@ -1456,24 +1456,176 @@
       %7D );%0A%0A
+      const equationNode = new RichText( '', %7B%0A        font: new PhetFont( 16 ),%0A        fill: options.color,%0A        rotation: Math.PI / 2%0A      %7D );%0A%0A
       assert
@@ -1724,16 +1724,30 @@
 = %5B path
+, equationNode
  %5D;%0A%0A   
@@ -1958,16 +1958,17 @@
 ic =%3E %7B%0A
+%0A
         
@@ -2044,16 +2044,50 @@
 = null;%0A
+          equationNode.text = '';%0A
         
@@ -2255,16 +2255,307 @@
  maxY );
+%0A%0A          equationNode.text = StringUtils.fillIn( '%7B%7Bx%7D%7D = %7B%7Bvalue%7D%7D', %7B%0A            x: GQSymbols.x,%0A            value: Util.toFixedNumber( quadratic.axisOfSymmetry, options.decimals )%0A          %7D );%0A          equationNode.left = path.right + 3;%0A          equationNode.top = path.top + 12;
 %0A       

add equation to axis of symmetry