<commit_before>import * as util from '../util';
import {extend} from '../util';
import {COLUMN, ROW, X, Y} from '../channel';
import {Model} from './Model';

import {compileAxis, compileInnerAxis, gridShow} from './axis';
import {compileScales} from './scale';

/**
 * return mixins that contains marks, scales, and axes for the rootGroup
 */
export function facetMixins(model: Model, marks) {
  const layout = model.layout();
  const cellConfig = model.config().cell;
  const cellWidth: any = !model.has(COLUMN) ?
      {field: {group: 'width'}} :     // cellWidth = width -- just use group's
    typeof layout.cellWidth !== 'number' ?
      {scale: model.scaleName(COLUMN), band: true} : // bandSize of the scale
      {value: layout.cellWidth};      // static value

  const cellHeight: any = !model.has(ROW) ?
      {field: {group: 'height'}} :  // cellHeight = height -- just use group's
    typeof layout.cellHeight !== 'number' ?
      {scale: model.scaleName(ROW), band: true} :  // bandSize of the scale
      {value: layout.cellHeight};   // static value

  let facetGroupProperties: any = {
    width: cellWidth,
    height: cellHeight
  };

  // add configs that are the resulting group marks properties
  ['clip', 'fill', 'fillOpacity', 'stroke', 'strokeWidth',
    'strokeOpacity', 'strokeDash', 'strokeDashOffset']
    .forEach(function(property) {
      const value = cellConfig[property];
      if (value !== undefined) {
        facetGroupProperties[property] = {value: value};
      }
    });

  let rootMarks = [], rootAxes = [], facetKeys = [], cellAxes = [];
  const hasRow = model.has(ROW), hasCol = model.has(COLUMN);

  // TODO(#90): add property to keep axes in cells even if row is encoded
  if (hasRow) {
    if (!model.isDimension(ROW)) {
      // TODO: add error to model instead
      util.error('Row encoding should be ordinal.');
    }
    facetGroupProperties.y = {
      scale: model.scaleName(ROW),
      field: model.field(ROW),<commit_msg>Don't use band of row/column scales to make sure the border of the cell works correctly<commit_after>import * as util from '../util';
import {extend} from '../util';
import {COLUMN, ROW, X, Y} from '../channel';
import {Model} from './Model';

import {compileAxis, compileInnerAxis, gridShow} from './axis';
import {compileScales} from './scale';

/**
 * return mixins that contains marks, scales, and axes for the rootGroup
 */
export function facetMixins(model: Model, marks) {
  const layout = model.layout();
  const cellConfig = model.config().cell;
  const cellWidth: any = !model.has(COLUMN) ?
      {field: {group: 'width'}} :     // cellWidth = width -- just use group's
    typeof layout.cellWidth !== 'number' ?
      {field: {parent: 'cellWidth'}} : // bandSize of the scale
      {value: layout.cellWidth};      // static value

  const cellHeight: any = !model.has(ROW) ?
      {field: {group: 'height'}} :  // cellHeight = height -- just use group's
    typeof layout.cellHeight !== 'number' ?
      {field: {parent: 'cellHeight'}} :  // bandSize of the scale
      {value: layout.cellHeight};   // static value

  let facetGroupProperties: any = {
    width: cellWidth,
    height: cellHeight
  };

  // add configs that are the resulting group marks properties
  ['clip', 'fill', 'fillOpacity', 'stroke', 'strokeWidth',
    'strokeOpacity', 'strokeDash', 'strokeDashOffset']
    .forEach(function(property) {
      const value = cellConfig[property];
      if (value !== undefined) {
        facetGroupProperties[property] = {value: value};
      }
    });

  let rootMarks = [], rootAxes = [], facetKeys = [], cellAxes = [];
  const hasRow = model.has(ROW), hasCol = model.has(COLUMN);

  // TODO(#90): add property to keep axes in cells even if row is encoded
  if (hasRow) {
    if (!model.isDimension(ROW)) {
      // TODO: add error to model instead
      util.error('Row encoding should be ordinal.');
    }
    facetGroupProperties.y = {
      scale: model.scaleName(ROW),
      field: model.field(ROW),
{'fraction_non_alphanumeric': 0.14885114885114886, 'fraction_numerical': 0.000999000999000999, 'mean_word_length': 3.2025183630640086, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2808373', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1192, 'n_words': 378}