How to use the victory.VictoryChart function in victory

To help you get started, we’ve selected a few victory examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maverick915 / southwest-price-drop-bot / lib / history-graph.js View on Github external
function render (alert) {
  const data = cloneDeep(alert.priceHistory);

  // hack to show graph if there is only one data point
  if (data.length === 1) {
    data.push(cloneDeep(data[0]));
    data[1].time = data[0].time + 1;
  }

  const times = data.map(d => d.time);
  const minTime = Math.min(...times);
  const maxTime = Math.max(...times);
  const maxPrice = Math.ceil(Math.max(...data.map(d => d.price)) / 50) * 50;

  const Graph = e('div', null, [
    e(V.VictoryChart, {
      domainPadding: 20,
      padding: { top: 10, right: 50, bottom: 50, left: 50 },
      theme: Theme
    }, [
      e(V.VictoryAxis, {
        domainPadding: 0,
        tickFormat: date => dateFormat(new Date(date), 'm/d', true)
      }),
      e(V.VictoryAxis, {
        crossAxis: false,
        dependentAxis: true,
        domain: [ 0, maxPrice ],
        tickFormat: tick => '$' + tick
      }),
      e(V.VictoryLine, {
        data,
github mathisonian / hyperchart / components / chart.js View on Github external
const Victory = require('victory');
const Axis = require('victory').VictoryAxis;
const Chart = Victory.VictoryChart;

const chartMap = {
  line: Victory.VictoryLine,
  scatter: Victory.VictoryScatter
};

const getStyles = (props) => {
  switch (props.type) {
    case 'line':
      return {
        stroke: props.foregroundColor
      };
    case 'scatter':
      return {
        fill: props.foregroundColor
      };