Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"domainPadding" not working when "domain" is set #648

Closed
jonathanchu opened this issue Jul 12, 2017 · 1 comment · Fixed by FormidableLabs/victory-chart#497
Closed

"domainPadding" not working when "domain" is set #648

jonathanchu opened this issue Jul 12, 2017 · 1 comment · Fixed by FormidableLabs/victory-chart#497
Assignees
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior

Comments

@jonathanchu
Copy link

jonathanchu commented Jul 12, 2017

It seems that when setting an explicit domain the domainPadding prop is not respected anymore. I've made a quick gif demonstrating this issue in a VictoryBar with the live demo:

victory-charts-domain-and-domain-padding-issue

@sbcreates
Copy link

It seems this is still an issue, or at least I'm having the same problem (could be user error ;) but I figured I'd try to see what's going on here). I'm using Victory Charts version 24.5

The chart I'm making renders data based on the time range selected by the user along with whether they want to see transfers or transactions for that date range.

The first image has the default date range (start of day to now) and it has no data as there were no transfers/transactions made. It has the right domain padding for the x axis only and doesn't show six ticks though six could fit nicely with the space given.

If I click a date range where there is data to show, the domain padding is wrong (see second image)

The domain padding doesn't seem to do anything for the y axis. Even if I change my code to explicitly note the domain padding for the x and y.

screen shot 2018-05-11 at 9 32 53 am

screen shot 2018-05-11 at 9 40 55 am

  <VictoryChart
    height={320}
    width={470}
    name={chartName}
    scale={{ x: 'time', y: 'linear' }}
    domain={domain}
    domainPadding={{x: 35}}
    animate={{ duration: 1000, onLoad: { duration: 500 } }}
    containerComponent={<VictoryVoronoiContainer />}
  >
    <VictoryAxis
      // x-axis
      tickCount={6}
      tickFormat={(t) => formatLocalChartTicks(dateRange, t)}
      style={{
        axis: { stroke: 'rgba(36, 55, 78, 0.7)', strokeWidth: 1 },
        tickLabels: {
          fill: 'rgba(36, 55, 78, 0.7)',
          fontSize: 10,
          fontFamily: 'Lato, sans-serif',
          angle: 315,
          verticalAnchor: "middle",
          textAnchor:'end',
          padding: 4,
        },
        ticks: { size: 4, stroke: 'rgba(36, 55, 78, 0.7)', strokeWidth: 1 },
      }}
    />
    <VictoryAxis
      dependentAxis
      tickCount={6}
      tickFormat={(t) => t.toString()}
      style={{
        axis: { stroke: 'transparent', strokeWidth: 1 },
        grid: { stroke: '#ebecee', strokeWidth: 1 },
        tickLabels: {
          fill: 'rgba(36, 55, 78, 0.6)',
          fontSize: 9,
          fontFamily: 'Lato, sans-serif'
        },
        // ticks: { size: 5, stroke: 'rgba(36, 55, 78, 0.7)', strokeWidth: 1 },
      }}
    />
    <VictoryScatter
      size={(datum, active) => (active ? 5 : 2)}
      data={data}
      x={xValue}
      y={yValue}
      labelComponent={
        <VictoryTooltip
          style={{
            fontSize: 9,
            fill: 'rgba(36, 55, 78, 0.7)',
            fontFamily: 'Lato, sans-serif',
          }}
          cornerRadius={2}
          flyoutStyle={{
            fill: 'white',
            stroke: 'rgba(36, 55, 78, 0.7)',
            strokeWidth: 0.5
          }}
        />
      }
      {...props}
    />
  </VictoryChart>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Oh no! A bug or unintentional behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants