/**
 * Configure the min, max and step controls for the specified data source.
 *
 * @param dataSource  SpectrumDataSource that provides the data to be drawn
 */
void RangeHandler::configureRangeControls(SpectrumDataSource_sptr dataSource) {
    m_totalMinX = dataSource->getXMin();
    m_totalMaxX = dataSource->getXMax();
    m_totalNSteps = dataSource->getNCols();

    double defaultStep = (m_totalMaxX - m_totalMinX) / (double)m_totalNSteps;
    if (m_totalNSteps > 2000)
        defaultStep = (m_totalMaxX - m_totalMinX) / 2000.0;

    setRange(m_totalMinX, m_totalMaxX, defaultStep);
}
/**
 * Configure the min, max and step controls for the specified data source.
 *
 * @param dataSource  SpectrumDataSource that provides the data to be drawn
 */
void RefRangeHandler::configureRangeControls( SpectrumDataSource_sptr dataSource )
{
  // X axis
  m_totalMinX   = dataSource->getXMin();
  m_totalMaxX   = dataSource->getXMax();
  m_totalNSteps = dataSource->getNCols();

  double defaultStepX = (m_totalMaxX - m_totalMinX) / (double)m_totalNSteps;
  if(m_totalNSteps > 2000)
    defaultStepX = (m_totalMaxX - m_totalMinX) / 2000.0;

  setRange(m_totalMinX, m_totalMaxX, defaultStepX, 'x');

  // Y axis
  m_totalMinY   = dataSource->getYMin();
  m_totalMaxY   = dataSource->getYMax();
  m_totalNSteps = dataSource->getNCols();

  double defaultStepY = (m_totalMaxY - m_totalMinY) / (double)m_totalNSteps;
  if(m_totalNSteps > 2000)
    defaultStepY = (m_totalMaxY - m_totalMinY) / 2000.0;

  setRange(m_totalMinY, m_totalMaxY, defaultStepY, 'y' );
}