HAHS.
Back to Catalog

Sort

interaction

Also known as: reorder, order by, sort by column, rank order

Show rankingEnable explorationCompare CategoricalNumericalTemporal

설명 / Description

정렬은 데이터 속성에 따라 차트의 시각 요소(막대, 행, 열, 마크)를 재배열하여, 임의적인 배치를 의미 있는 배치로 바꿉니다. 막대 차트에서 막대를 높은 것부터 낮은 것 순으로 정렬하면 알파벳순 배열에서는 보이지 않았을 순위 구조가 즉시 드러납니다. 히트맵에서는 유사도에 따라 행과 열을 재배열하면 잠재된 군집이 드러날 수 있습니다. 정렬은 겉보기에는 단순하지만, 인간의 시각 시스템이 단조로운 추세를 감지하고 순위 이상치를 한눈에 파악하는 능력을 활용하기 때문에 시각화에서 가장 강력한 인지적 보조 수단 중 하나입니다.

Sorting reorders the visual elements of a chart (bars, rows, columns, marks) according to a data attribute, transforming an arbitrary arrangement into a meaningful one. In a bar chart, sorting bars from tallest to shortest instantly reveals the ranking structure that would be invisible in an alphabetical ordering. In a heatmap, reordering rows and columns by similarity can expose latent clusters. Sorting is deceptively simple, but it is one of the most powerful cognitive aids in visualization because it exploits the human visual system's ability to detect monotonic trends and rank-order outliers at a glance.

이(Yi) 등(2007)은 정렬을 "재구성(reconfigure)" 인터랙션 의도로 분류합니다 — 데이터 자체나 시각적 인코딩은 바꾸지 않으면서 데이터 마크의 공간적 배치를 바꿔 데이터의 다른 측면을 드러내는 것입니다. 핵심 통찰은 같은 데이터, 같은 막대 길이라도 순서에 따라 전혀 다른 이야기를 전달한다는 점입니다. 국가별 1인당 GDP를 알파벳순으로 정렬한 막대 차트는 룩셈부르크와 노르웨이가 이상치라는 사실을 숨기지만, 값순으로 정렬한 버전은 이를 즉시 명백하게 드러냅니다.

Yi et al. (2007) classify sorting under the "reconfigure" interaction intent — changing the spatial arrangement of data marks to reveal a different aspect of the data without changing the data itself or the visual encoding. The key insight is that the same data, with the same bar lengths, tells a very different story depending on order. An alphabetically sorted bar chart of countries' GDP per capita hides the fact that Luxembourg and Norway are outliers; a value-sorted version makes this immediately obvious.

인터랙티브 정렬은 사용자가 어떤 열이든 기준으로 정렬하고 싶어 할 수 있는 표와 표 형태의 시각화(히트맵, 행렬 뷰)에서 특히 중요합니다. 열 헤더를 클릭해 오름차순/내림차순 정렬을 전환하는 것은 웹에서 가장 익숙한 인터랙션 패턴 중 하나이며, 시각화 맥락에도 자연스럽게 옮겨갑니다. 정렬 순서 간의 전환에 애니메이션을 적용하면, 사용자가 개별 요소를 추적하고 재배열이 상대적 위치에 어떤 영향을 미치는지 이해하는 데 도움이 됩니다.

Interactive sort is especially important in tables and table-like visualizations (heatmaps, matrix views) where the user might want to sort by any column. Clicking a column header to toggle ascending/descending sort is one of the most familiar interaction patterns on the web, and it transfers naturally to visualization contexts. The transition between sort orders, when animated, helps the user track individual elements and understand how the reordering affects relative positions.

Sort — try it yourself

언제 사용하나 / When to Use

  • 차트에 범주형 축(막대 차트, 점 도표)이 있고, 기본 순서(알파벳순, 입력 순서)가 순위 패턴을 드러내지 못할 때.
  • When the chart has a categorical axis (bar chart, dot plot) and the default ordering (alphabetical, insertion order) does not reveal the ranking pattern.
  • 사용자가 어떤 열로든 정렬하고 싶어 할 수 있는 표와 표 형태의 시각화에서.
  • In tables and table-like visualizations where the user may want to sort by any column.
  • 군집화나 유사도에 따라 행/열을 재배열하면 블록 구조가 드러나는 히트맵에서.
  • In heatmaps where reordering rows/columns by clustering or similarity reveals block structure.
  • 사용자의 과제가 명시적으로 순위에 관한 것일 때("어떤 항목이 가장 높은가?", "어떤 항목이 가장 낮은가?").
  • When the user's task is explicitly about ranking ("which items are highest?", "which are lowest?").
  • 여러 정렬 기준(매출순 정렬 후 성장률순 정렬)을 비교하면 서로 다른 이야기가 드러날 때.
  • When comparing multiple sort criteria (sort by revenue, then by growth rate) reveals different stories.

이럴 땐 피하세요 / When NOT to Use

  • 축에 보존해야 할 본질적으로 의미 있는 순서가 있을 때 — 예: 타임라인 상의 시간, 프로세스의 단계, "낮음/중간/높음" 같은 순서형 척도.
  • When the axis has an inherent meaningful order that should be preserved — e.g., time on a timeline, stages in a process, ordinal scales like "low/medium/high."
  • 차트에 항목이 2~3개뿐일 때 — 정렬은 무의미하며 인터랙션이 불필요한 복잡성만 더합니다.
  • When the chart has only 2-3 items — sorting is trivial and the interaction adds unnecessary complexity.
  • 두 축이 모두 연속형인 산점도에서 — 한 축을 따라 정렬하면 2차원 공간 인코딩이 왜곡됩니다.
  • In scatter plots where both axes are continuous — sorting along one axis would distort the 2D spatial encoding.
  • 너무 많은 요소가 동시에 움직여(약 50개 이상) 애니메이션 재배열이 혼란스러울 때.
  • When animated reordering would be disorienting due to too many elements moving simultaneously (more than ~50).

작동 방식 / How It Works

  1. 사용자가 정렬 컨트롤을 클릭합니다 — 열 헤더, "정렬 기준" 드롭다운, 또는 정렬 속성과 방향을 나타내는 토글 버튼입니다.
  2. The user clicks a sort control — a column header, a "Sort by" dropdown, or a toggle button indicating the sort attribute and direction.
  3. 시스템이 선택된 속성(오름차순 또는 내림차순)에 따라 데이터 항목의 새로운 순서를 계산합니다.
  4. The system computes the new ordering of the data items according to the selected attribute (ascending or descending).
  5. 마크가 재배열된 축을 따라 재배치됩니다. 애니메이션이 활성화되어 있으면 각 마크가 새 위치로 부드럽게 전환되어, 사용자가 개별 항목을 추적하는 데 도움을 줍니다.
  6. The marks are repositioned along the reordered axis. If animation is enabled, each mark smoothly transitions to its new position, helping the user track individual items.
  7. 축 레이블이 갱신되어 새로운 순서를 반영합니다.
  8. The axis labels update to reflect the new ordering.
  9. 같은 정렬 컨트롤을 다시 클릭하면 방향이 전환됩니다(오름차순 ↔ 내림차순).
  10. Clicking the same sort control again toggles the direction (ascending ↔ descending).
  11. 시각적 표시자(화살표 아이콘, 강조된 헤더)가 현재 어떤 속성이, 어떤 방향으로 활성화되어 있는지 보여줍니다.
  12. A visual indicator (arrow icon, highlighted header) shows which attribute is currently active and in which direction.

변형 / Variations

  • 헤더 클릭 정렬: 열 헤더를 클릭하면 그 열을 기준으로 정렬됩니다. 데이터 테이블의 표준 방식입니다.
  • Click-header sort: Clicking a column header sorts by that column. Standard in data tables.
  • 드롭다운 정렬: 드롭다운 메뉴로 사용자가 정렬 속성을 선택할 수 있습니다. 정렬 가능한 차원이 많을 때 유용합니다.
  • Dropdown sort: A dropdown menu lets the user choose the sort attribute. Useful when there are many sortable dimensions.
  • 다단계 정렬: 1차 속성으로 정렬한 뒤 2차 속성으로 동률을 처리합니다(예: 범주로 먼저 정렬하고, 각 범주 내에서 값으로 정렬).
  • Multi-level sort: Sort by a primary attribute, then break ties by a secondary attribute (e.g., sort by category, then by value within each category).
  • 클러스터 정렬: 단일 속성이 아니라 군집화 알고리즘(예: 히트맵에서의 계층적 군집화)을 이용해 재배열합니다.
  • Cluster sort: Reorder using a clustering algorithm (e.g., hierarchical clustering on a heatmap) rather than a single attribute.
  • 수동 드래그 정렬: 사용자가 직접 항목을 드래그해 재배열하며, 커스텀 우선순위 순서에 유용합니다.
  • Manual drag sort: The user manually drags items to reorder them, useful for custom priority ordering.
  • 애니메이션 정렬: 막대나 행이 부드러운 전환과 함께 새 위치로 슬라이드하여, 객체 지속성(object constancy)을 유지합니다.
  • Animated sort: Bars or rows slide to their new positions with a smooth transition, preserving object constancy.

코드 레퍼런스 / Code Reference

// D3.js animated bar chart sort
let ascending = true;
d3.select("#sort-btn").on("click", () => {
  ascending = !ascending;
  const sorted = [...data].sort((a, b) =>
    ascending ? a.value - b.value : b.value - a.value
  );
  xScale.domain(sorted.map(d => d.name));
  svg.selectAll("rect")
    .transition().duration(600)
    .attr("x", d => xScale(d.name));
  svg.select(".x-axis")
    .transition().duration(600)
    .call(d3.axisBottom(xScale));
});