Skip to content
This repository has been archived by the owner on Feb 19, 2022. It is now read-only.

Feature/pass mapped tick to tick format #471

Merged
merged 3 commits into from
May 24, 2017

Conversation

DerekMaffett
Copy link
Contributor

@DerekMaffett DerekMaffett commented May 16, 2017

Related: FormidableLabs/victory-core#247

Fixes the following issue as well as isolates the logic for tick formatting in chart contexts into a single location. Before it relied on a bunch of branching.

FormidableLabs/victory#585

@boygirl
Copy link
Contributor

boygirl commented May 17, 2017

Something is going wrong when tickValues are dates:
screen shot 2017-05-16 at 6 41 14 pm

<VictoryChart style={chartStyle}
            scale={{
              x: "time"
            }}
          >
            <VictoryAxis
              orientation="bottom"
              label={"A LABEL"}
              tickValues={[
                new Date(1980, 1, 1),
                new Date(1990, 1, 1),
                new Date(2000, 1, 1),
                new Date(2010, 1, 1),
                new Date(2020, 1, 1)
              ]}
              tickFormat={(x) => new Date(x).getFullYear()}
            />
            <VictoryLine
              style={{
                data: { stroke: "red", strokeWidth: 5 },
                labels: { fontSize: 12 }
              }}
              label={this.state.label}
              data={[
                { x: new Date(1982, 1, 1), y: 125 },
                { x: new Date(1987, 1, 1), y: 257 },
                { x: new Date(1993, 1, 1), y: 345 },
                { x: new Date(1997, 1, 1), y: 515 },
                { x: new Date(2001, 1, 1), y: 132 },
                { x: new Date(2005, 1, 1), y: 305 },
                { x: new Date(2011, 1, 1), y: 270 },
                { x: new Date(2015, 1, 1), y: 470 }
              ]}
            />
          </VictoryChart>

@DerekMaffett
Copy link
Contributor Author

@boygirl Ordering issue on the pipeline that was making tickValues override tickFormat. Fixed it.

@boygirl
Copy link
Contributor

boygirl commented May 18, 2017

@DerekMaffett I'll get this in after doing a release of victory-core

@boygirl boygirl merged commit 2c7d9ce into master May 24, 2017
@boygirl boygirl deleted the feature/pass-mapped-tick-to-tickFormat branch May 24, 2017 18:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants