Data Visualization — Taiwan Sexual Assault Statistics
# FrontendI wanted to implement this topic because I came across some news and the data was relatively complete. I thought it would be a great opportunity to promote Svelte itself, so I started brainstorming and implemented it. You can find the final product here.

Data visualization has always been one of the areas I want to dive deeper into. It’s not just about creating flashy charts; I hope to hone my storytelling skills through it, and data visualization is a fantastic medium for practice.
Previously, I’ve worked on several projects, but they always felt rushed, lacking attention to detail. I’ve decided that moving forward, I’ll focus on organizing the components I use frequently.
- The Labor Day Report I created in 2017
- The Year In Review I wrote in 2017
- The Fukuoka COVID-19 Infection Status I published in April 2020: the charts are now misaligned, as I didn’t foresee the pandemic lasting this long.
Data Organization
Most of the data comes from the Ministry of Health and Welfare, and it’s quite detailed. However, the data is primarily in Excel format, so I spent a considerable amount of time converting it into a more manageable data format.
Implementation
Technically, I used Svelte and d3 for development. I hope to gradually create a set of chart components that I find easy to use. Currently, I’m still observing usage scenarios, so the components are somewhat rigid, but I should be able to improve them over time.
Elements to consider for a standard line chart include:
- x and y axes and ticks
- x and y scale settings
- styles for straight and horizontal lines
- chart title and units
- text settings
- transitions
- tooltips: hover actions over the line chart
With d3, I only used d3-scale here, and I didn’t utilize d3 patterns, such as:
d3.select('svg')
.enter()
.data(data)
.append()
...
The main reason is that I wanted to delegate all these operations to Svelte. However, doing transitions and managing enter/exit patterns has been somewhat cumbersome because while d3 can handle these directly via API calls, Svelte requires a different handling approach. I’ll look into how to adjust this for better performance. I also adopted the newer Snowpack for this project, which made development quite smooth, and I highly recommend it.
On the backend, I used Kotlin as the API server. This was my first time working with it, and I found it quite comfortable. Additionally, I may want to implement scheduling or multi-threading tasks later on, so using Kotlin will be more convenient. The server was deployed directly to App Engine, and using Gradle made it quite easy.
Reflection
I completed the main implementation in about two days, with the rest of the time spent refining details and interactions. To be honest, there wasn’t much interaction this time; I mainly focused on how to present the information effectively. This project primarily displays data, but for future projects, I want to introduce more possibilities and interactions, along with exploring how to tell stories through interaction.
Related Posts
- CSS field-sizing — Auto-Resize Form Elements with One Line of CSSMaking a textarea auto-resize used to require JavaScript to watch scrollHeight. CSS field-sizing: content replaces all of that in one line, supporting textarea, input, and select.
- Make Your Hyperlink Underlines Look Better: text-underline-offsetBy default, underlines sit very close to the text, and some designers dislike this style. Personally, I don’t think it looks very good either.
- Why Web Design Shouldn’t Chase Pixel PerfectOnly pay attention to Pixel Perfect when it really matters; otherwise, it often leads to a lose-lose situation.
- Let’s Write Colors with CSS HSL! (And a Better Way)In web development, the traditional HEX and RGB color notations are widely used, but they are not very readable or intuitive, and their capabilities are limited in wider color spaces such as P3. HSL (Hue, Saturation, Lightness) provides a more intuitive way to define colors, making it easier for developers to understand and adjust them. By describing colors through the three dimensions of hue, saturation, and lightness, HSL makes color adjustment more human-friendly. In design systems in particular, HSL can better represent lightness variations in a color palette.