spb/internetpressure
Public
TypeScript 36.3%
Python 31.8%
Go 18%
JavaScript 9.8%
Shell 1.9%
SQL 1.4%
CSS 0.5%
1'use client';23import { BarChart, LineChart } from 'echarts/charts';4import { DataZoomComponent, GridComponent, LegendComponent, MarkAreaComponent, MarkLineComponent, TooltipComponent } from 'echarts/components';5import * as echarts from 'echarts/core';6import { CanvasRenderer } from 'echarts/renderers';7import type { ComposeOption } from 'echarts/core';8import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts';9import type { DataZoomComponentOption, GridComponentOption, LegendComponentOption, MarkAreaComponentOption, MarkLineComponentOption, TooltipComponentOption } from 'echarts/components';1011echarts.use([LineChart, BarChart, GridComponent, TooltipComponent, LegendComponent, MarkAreaComponent, MarkLineComponent, DataZoomComponent, CanvasRenderer]);1213export type EChartsOption = ComposeOption<LineSeriesOption | BarSeriesOption | GridComponentOption | TooltipComponentOption | LegendComponentOption | MarkAreaComponentOption | MarkLineComponentOption | DataZoomComponentOption>;1415export default echarts;1617/** Shared dark theme fragments (hairlines, mono numerals). */18export const AXIS_STYLE = {19 axisLine: { lineStyle: { color: '#1B2430' } },20 axisTick: { show: false },21 axisLabel: { color: '#8B98A5', fontFamily: 'var(--font-geist-mono), ui-monospace, monospace', fontSize: 10.5 },22 splitLine: { lineStyle: { color: '#151C25' } },23};24export const TOOLTIP_STYLE = {25 backgroundColor: '#0C1117',26 borderColor: '#1B2430',27 borderWidth: 1,28 padding: [6, 10],29 textStyle: { color: '#E6EDF3', fontSize: 11.5, fontFamily: 'var(--font-geist-mono), ui-monospace, monospace' },30 extraCssText: 'border-radius:4px;box-shadow:none;',31};32export const LEVEL_BANDS: [number, number, string][] = [33 [0, 10, '#4CC9F0'],34 [10, 25, '#7FB77E'],35 [25, 40, '#E9C46A'],36 [40, 55, '#F4A261'],37 [55, 70, '#E76F51'],38 [70, 85, '#D62828'],39 [85, 100, '#F72585'],40];41export const levelMarkArea = (alpha = 0.05): NonNullable<LineSeriesOption['markArea']> => ({42 silent: true,43 data: LEVEL_BANDS.map(([lo, hi, c]) => [{ yAxis: lo, itemStyle: { color: c + Math.round(alpha * 255).toString(16).padStart(2, '0') } }, { yAxis: hi }] as [{ yAxis: number; itemStyle: { color: string } }, { yAxis: number }]),44});45export type { LineSeriesOption, BarSeriesOption };46