void module(ArrayList mainList, int mainPick)
{
  noStroke();

  IntList sortedData = new IntList();
  IntDict pairedData = new IntDict();
  sortedData = (IntList)mainList.get(mainPick);
  float avg = 0;
  int sum = 0;
  float max = sortedData.max();
  float startAngle = -0.8;

  int [] column_picks = {0,3,4,5};

  // create a dictionary to keep track of where the values belong to
  // key = # of checkouts, value = dewey # (-630)
  for (int i = 0; i < numColumns; i++) {
    pairedData.set(str(i), sortedData.get(i));
    sum += sortedData.get(i);
  }
  avg = sum/numColumns;
  sortedData.sortReverse();
  
  // init label switch
  int labelIndex = -1;

  for (int i = 0; i < column_picks.length; i++)
  {
    
    float maxRatio = sortedData.get(i)/max;
    float sumRatio = sortedData.get(i)/sum;
    float newVal = sortedData.get(i)*365/sum;
    float endAngle = startAngle + radians(newVal);
    float newSize = chartRadius + (sortedData.get(i)*300)/sum;

    // get mouse position relative to sketch center
    float translateX = map(mouseX, 0, width, -width/2, width/2);
    float translateY = map(mouseY, 0, height, -height/2, height/2);

    // cartesian to polar coordinates
    float mouseRad = sqrt(pow(translateY, 2) + pow(translateX, 2));
    float mouseAngle = atan2(translateY, translateX);

    // fix for full circle
    if (mouseAngle < 0) {
      mouseAngle = PI + (PI + mouseAngle);
    }


    // mouse interaction
    colorMode(HSB);
    float fillColor = 255 * maxRatio;
    float fillAlpha = (fillColor*20)+20;
    if (((mouseAngle > startAngle) && (mouseAngle < endAngle)) 
          && (mouseRad < newSize * .5) && (mouseRad > innerCircleRadius * .5)) {
      // mouse over segment
      fill(colorMapSelected[i]);
      labelIndex = i;
    } else if ( (startAngle < 0) && (mouseAngle > startAngle+(2*PI)) && (mouseAngle < 2*PI) 
                  && (mouseRad < newSize * .5) && (mouseRad > innerCircleRadius * .5))  {
      fill(colorMapSelected[i]);
      labelIndex = i;
    } else {
      // mouse not over segment
//      fill(115-(i*10), 130, (maxRatio * 255)+20, fillAlpha);
      fill(colorMap[i]);
    }
    colorMode(RGB);


    // draw the chart
    arc(width/2, height/2, newSize, newSize, startAngle, endAngle);
    
    // draw another partially transparent chart on top so colors change with month
    fill(colorMapMonth[round(avgColorPick)],100);
    arc(width/2, height/2, newSize, newSize, startAngle, endAngle);
    
    startAngle = endAngle;

    fill(bgColor);
    ellipse(width/2, height/2, innerCircleRadius, innerCircleRadius);
    
    // draw the label
    if (labelIndex != -1) {               
      String txt = "" + sortedData.get(labelIndex);
      float labelW = textWidth(txt);
      // rect(mouseX+5, mouseY-25, labelW+10, 22);
      // stroke(tickColor);
      fill(tickColor);
      textFont(fontCenter);
      textAlign(CENTER,CENTER);
      text(txt, width/2, (height/2)-10);
    }
  
  }
}

