all files / src/components/ VictoryTheme.js

0% Statements 0/14
100% Branches 0/0
100% Functions 0/0
0% Lines 0/14
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174                                                                                                                                                                                                                                                                                                                                                           
const { assign } = Object;
 
const A11Y_BABU = '#00A699';
const AXIS_LINE_GRAY = '#484848';
 
// Colors
const colors = [
  '#ffffff',
  '#f0f0f0',
  '#d9d9d9',
  '#bdbdbd',
  '#969696',
  '#737373',
  '#525252',
  '#252525',
  '#000000',
];
 
const charcoal = '#484848';
 
// Typography
const sansSerif = '"Roboto", sans-serif';
const letterSpacing = 'normal';
const fontSize = 8;
 
// Layout
const baseProps = {
  width: 450,
  height: 300,
  padding: 50,
  colorScale: colors,
};
 
// Labels
const baseLabelStyles = {
  fontFamily: sansSerif,
  fontSize,
  letterSpacing,
  padding: 10,
  fill: charcoal,
  stroke: 'transparent',
};
 
// Strokes
const strokeLinecap = 'round';
const strokeLinejoin = 'round';
 
// Create the theme
const theme = {
  area: assign({
    style: {
      data: {
        fill: charcoal,
      },
      labels: baseLabelStyles,
    },
  }, baseProps),
  axis: assign({
    style: {
      axis: {
        fill: 'none',
        stroke: AXIS_LINE_GRAY,
        strokeWidth: 1,
        strokeLinecap,
        strokeLinejoin,
      },
      axisLabel: assign({}, baseLabelStyles, {
        padding: 25,
      }),
      grid: {
        fill: 'none',
        stroke: 'transparent',
      },
      ticks: {
        fill: 'none',
        padding: 10,
        size: 1,
        stroke: 'transparent',
      },
      tickLabels: baseLabelStyles,
    },
  }, baseProps),
  bar: assign({
    style: {
      data: {
        fill: A11Y_BABU,
        padding: 10,
        stroke: 'transparent',
        strokeWidth: 0,
        width: 8,
      },
      labels: baseLabelStyles,
    },
  }, baseProps),
  candlestick: assign({
    style: {
      data: {
        stroke: A11Y_BABU,
        strokeWidth: 1,
      },
      labels: assign({}, baseLabelStyles, {
        padding: 25,
        textAnchor: 'end',
      }),
    },
    candleColors: {
      positive: '#ffffff',
      negative: charcoal,
    },
  }, baseProps),
  chart: baseProps,
  errorbar: assign({
    style: {
      data: {
        fill: 'none',
        stroke: charcoal,
        strokeWidth: 2,
      },
      labels: assign({}, baseLabelStyles, {
        textAnchor: 'start',
      }),
    },
  }, baseProps),
  group: assign({
    colorScale: colors,
  }, baseProps),
  line: assign({
    style: {
      data: {
        fill: 'none',
        stroke: A11Y_BABU,
        strokeWidth: 2,
      },
      labels: assign({}, baseLabelStyles, {
        textAnchor: 'start',
      }),
    },
  }, baseProps),
  pie: {
    style: {
      data: {
        padding: 10,
        stroke: 'none',
        strokeWidth: 1,
      },
      labels: assign({}, baseLabelStyles, {
        padding: 200,
        textAnchor: 'middle',
      }),
    },
    colorScale: colors,
    width: 400,
    height: 400,
    padding: 50,
  },
  scatter: assign({
    style: {
      data: {
        fill: charcoal,
        stroke: 'transparent',
        strokeWidth: 0,
      },
      labels: assign({}, baseLabelStyles, {
        textAnchor: 'middle',
      }),
    },
  }, baseProps),
  stack: assign({
    colorScale: colors,
  }, baseProps),
};
 
export default theme;