-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add manual Y-axis range controls with auto fallback #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,8 @@ export function RegexControls({ | |
| uploadedFiles = [], | ||
| xRange, | ||
| onXRangeChange, | ||
| yRange, | ||
| onYRangeChange, | ||
| maxStep | ||
| }) { | ||
| const [showPreview, setShowPreview] = useState(false); | ||
|
|
@@ -182,6 +184,11 @@ export function RegexControls({ | |
| onXRangeChange(newRange); | ||
| }; | ||
|
|
||
| const handleYRangeChange = (field, value) => { | ||
| const newRange = { ...yRange, [field]: value === '' ? undefined : Number(value) }; | ||
| onYRangeChange(newRange); | ||
|
Comment on lines
+187
to
+189
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Parsing Useful? React with 👍 / 👎. |
||
| }; | ||
|
|
||
| // Function to render config panel | ||
| const renderConfigPanel = (type, config, onConfigChange, index) => { | ||
| const ModeIcon = MODE_CONFIG[config.mode].icon; | ||
|
|
@@ -353,6 +360,45 @@ export function RegexControls({ | |
| </div> | ||
| </div> | ||
|
|
||
| <div className="border border-gray-200 dark:border-gray-700 rounded-lg p-3"> | ||
| <div className="flex items-center gap-2 mb-2"> | ||
| <ZoomIn | ||
| size={16} | ||
| className="text-gray-600 dark:text-gray-300" | ||
| aria-hidden="true" | ||
| /> | ||
| <h4 className="text-base font-semibold text-gray-800 dark:text-gray-100"> | ||
| {t('regex.yRange')} | ||
| </h4> | ||
| </div> | ||
| <div className="flex items-center gap-2"> | ||
| <input | ||
| type="number" | ||
| placeholder={t('regex.min')} | ||
| value={yRange?.min ?? ''} | ||
| onChange={(e) => handleYRangeChange('min', e.target.value)} | ||
| className="input-field" | ||
| /> | ||
| <span className="text-gray-500 dark:text-gray-400">-</span> | ||
| <input | ||
| type="number" | ||
| placeholder={t('regex.max')} | ||
| value={yRange?.max ?? ''} | ||
| onChange={(e) => handleYRangeChange('max', e.target.value)} | ||
| className="input-field" | ||
| /> | ||
| <button | ||
| onClick={() => onYRangeChange({ min: undefined, max: undefined })} | ||
| className="px-2 py-1 text-xs bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-300 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 whitespace-nowrap" | ||
| > | ||
| {t('regex.auto')} | ||
| </button> | ||
| </div> | ||
| <p className="text-xs text-gray-500 dark:text-gray-400 mt-1"> | ||
| {t('regex.yRangeHint')} | ||
| </p> | ||
| </div> | ||
|
|
||
| <div className="border border-gray-200 dark:border-gray-700 rounded-lg p-3"> | ||
| <div className="flex items-center gap-2 mb-2"> | ||
| <ZoomIn | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After applying manual bounds, this function keeps
autoScale.stepunchanged while replacingmin/max, so the chart can use a step size that no longer matches the displayed range. In practice, widening bounds (for example from an auto range near0..1to a manual max in the thousands) can produce extremely dense ticks and hurt chart readability/performance.Useful? React with 👍 / 👎.