Skip to content

Commit

Permalink
Post CR address
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanwlee committed Oct 18, 2018
1 parent c5dc4a0 commit 878eb7a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 8 additions & 6 deletions tensorboard/components/vz_line_chart2/linear-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ export class LinearScale extends Plottable.Scales.Linear implements ITfScale {

/**
* Adds some padding to a given domain. Specifically, it:
* - returns about [-0.1a, 2.1a] when a = b and a >= 0.
* - returns about [-2.1a, 0.1a] when a = b and a < 0.
* - returns about [-0.1a - c, 2.1a + c] when a = b and a >= 0.
* - returns about [-2.1|a| - c, -0.1|a| + c] when a = b and a < 0.
* - returns [-0.1b, b + padProportion * (b-a)] if b > 2a and a > 0
* - else, pads by `padProportion`
* Note that `c` is a constant offset which specifically is 1.1. Please refer
* to [1] for its rationale.
* @override
*/
protected _niceDomain(domain: number[], count?: number): number[] {
Expand All @@ -51,10 +53,10 @@ export class LinearScale extends Plottable.Scales.Linear implements ITfScale {

let lower: number;
if (a >= 0 && a < span) {
// We include the intercept (y = 0) if doing so less than doubles the span
// of the y-axis. (We actually select a lower bound that's slightly less
// than 0 so that 0.00 will clearly be written on the lower edge of the
// chart. The label on the lowest tick is often filtered out.)
// [1]: We include the intercept (y = 0) if doing so less than doubles the
// span of the y-axis. (We actually select a lower bound that's slightly
// less than 0 so that 0.00 will clearly be written on the lower edge of
// the chart. The label on the lowest tick is often filtered out.)
lower = -0.1 * b;
} else {
lower = a - padding;
Expand Down
2 changes: 1 addition & 1 deletion tensorboard/components/vz_line_chart2/log-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace vz_line_chart2 {
const MIN_VALUE = 1e-15;

function log(x: number): number {
return Math.log(x) / Math.log(10);
return Math.log10(x);
}

function pow(x: number): number {
Expand Down
8 changes: 3 additions & 5 deletions tensorboard/components/vz_line_chart2/tf-scale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ export type ValueProviderForDomain = () => number[];

/**
* Plottable.Scale is a class that wraps the d3.scale that adds many utility
* methods that work with the Plottable's `dataset` concept. Here, we will
* attempt to explain few basic concepts in plain English.
* - domain: [f(min(x)), f(max(x))]
* - range: pixel values of the chart
* methods that work with the Plottable's `dataset` concept.
*
* Plottable.Scale provides some cool feature where a scale is bound to set of
* plots (i.e., line, scatter, smooth line chart, etc...) and, when a dataset
Expand Down Expand Up @@ -72,7 +69,8 @@ export abstract class TfScale extends Plottable.QuantitativeScale<number> implem
/**
* Returns possible `extent`s for a dataset. Note that a dataset can contain
* multiple series.
* Unlike the method name suggests, it uses `values` to return `extent`s.
* Unlike the method name suggests, it uses values from each series to
* return `extent`s.
* @override
*/
protected _getAllIncludedValues(ignoreAttachState = false): number[] {
Expand Down

0 comments on commit 878eb7a

Please sign in to comment.