<commit_before>/*
 * Copyright 2008 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.android.apps.mytracks;

import com.google.android.apps.mytracks.ChartValueSeries.ZoomSettings;
import com.google.android.apps.mytracks.content.Waypoint;
import com.google.android.apps.mytracks.stats.ExtremityMonitor;
import com.google.android.apps.mytracks.util.StringUtils;
import com.google.android.apps.mytracks.util.UnitConversions;
import com.google.android.maps.mytracks.R;

import android.content.Context;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.drawable.Drawable;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.Scroller;

import java.text.NumberFormat;
import java.util.ArrayList;

/**
 * Visualization of the chart.
 *
 * @author <NAME>
 * @author <NAME>
 */
public class ChartView extends View {
  private static final int MIN_ZOOM_LEVEL = 1;

  /*
   * Scrolling logic:
   */
  private final Scroller scroller;
  private VelocityTracker velocityTracker = null;
  /** Position of the last motion event */
  private float lastMotionX;

  /*
   * Zoom logic:
   */
  private int zoomLevel = 1;
  private int maxZoomLevel = 10;

  private static final int MAX_INTERVALS = 5;

  /*
   * Borders, margins, dimensions (in pixels):
   */
  private int leftBorder = -1;

  /**
   * Unscaled top border of the chart.
   */
  private static final int TOP_BORDER = 15;

  /**
   * Device scaled top border of the chart.
   */
  private int topBorder;

  /**
   * Unscaled bottom border of the chart.
   */
  private static final float BOTTOM_BORDER = 40;

  /**
   * Device scaled bottom border of the chart.
   */
  private int bottomBorder;

  private static final int RIGHT_BORDER = 17;

  /** Space to leave for drawing the unit labels */
  private static final int UNIT_BORDER = 15;
  private static final int FONT_HEIGHT = 10;

  private int w = 0;
  private int h = 0;
  private int effectiveWidth = 0;
  private int effectiveHeight = 0;

  /*
   * Ranges (in data units):
   */
  private double maxX = 1;

  /**
   * The various series.
   */
  public static final int ELEVATION_SERIES = 0;
  public static final int SPEED_SERIES = 1;
  public static final int POWER_SERIES = 2;<commit_msg>Change the chart right border to 40 pixels.<commit_after>/*
 * Copyright 2008 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.android.apps.mytracks;

import com.google.android.apps.mytracks.ChartValueSeries.ZoomSettings;
import com.google.android.apps.mytracks.content.Waypoint;
import com.google.android.apps.mytracks.stats.ExtremityMonitor;
import com.google.android.apps.mytracks.util.StringUtils;
import com.google.android.apps.mytracks.util.UnitConversions;
import com.google.android.maps.mytracks.R;

import android.content.Context;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.drawable.Drawable;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.Scroller;

import java.text.NumberFormat;
import java.util.ArrayList;

/**
 * Visualization of the chart.
 *
 * @author <NAME>
 * @author <NAME>
 */
public class ChartView extends View {
  private static final int MIN_ZOOM_LEVEL = 1;

  /*
   * Scrolling logic:
   */
  private final Scroller scroller;
  private VelocityTracker velocityTracker = null;
  /** Position of the last motion event */
  private float lastMotionX;

  /*
   * Zoom logic:
   */
  private int zoomLevel = 1;
  private int maxZoomLevel = 10;

  private static final int MAX_INTERVALS = 5;

  /*
   * Borders, margins, dimensions (in pixels):
   */
  private int leftBorder = -1;

  /**
   * Unscaled top border of the chart.
   */
  private static final int TOP_BORDER = 15;

  /**
   * Device scaled top border of the chart.
   */
  private int topBorder;

  /**
   * Unscaled bottom border of the chart.
   */
  private static final float BOTTOM_BORDER = 40;

  /**
   * Device scaled bottom border of the chart.
   */
  private int bottomBorder;

  private static final int RIGHT_BORDER = 40;

  /** Space to leave for drawing the unit labels */
  private static final int UNIT_BORDER = 15;
  private static final int FONT_HEIGHT = 10;

  private int w = 0;
  private int h = 0;
  private int effectiveWidth = 0;
  private int effectiveHeight = 0;

  /*
   * Ranges (in data units):
   */
  private double maxX = 1;

  /**
   * The various series.
   */
  public static final int ELEVATION_SERIES = 0;
  public static final int SPEED_SERIES = 1;
  public static final int POWER_SERIES = 2;
{'fraction_non_alphanumeric': 0.09048387096774194, 'fraction_numerical': 0.01064516129032258, 'mean_word_length': 3.672946495855313, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3748361', 'n_tokens_mistral': 1894, 'n_tokens_neox': 1780, 'n_words': 624}