Skip to content

Commit

Permalink
Add tip for yield curve spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
SlicedSilver committed Dec 9, 2024
1 parent 4ebcc11 commit 8b2a7fd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions website/docs/chart-types.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ const chart = createYieldCurveChart(document.getElementById('container'), option

Use this chart type when you need to visualize yield curves or similar financial data where the horizontal scale represents time durations rather than specific dates.

:::tip

If you want to spread out the beginning of the plot further and don't need a linear time scale, you can enforce a minimum spacing around each point by increasing the [`minBarSpacing`](api/interfaces/TimeScaleOptions.md#minbarspacing) option in the TimeScaleOptions. To prevent the rest of the chart from spreading too wide, adjust the `baseResolution` to a larger number, such as `12` (months).

:::

export const yieldCurveExample = `const chartOptions = {
layout: { textColor: CHART_TEXT_COLOR, background: { type: 'solid', color: CHART_BACKGROUND_COLOR } },
yieldCurve: { baseResolution: 1, minimumTimeRange: 10, startTimeRange: 3 },
Expand Down
6 changes: 5 additions & 1 deletion website/tutorials/demos/yield-curve-with-update-markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ const curve2 = [
// hide-end

const chartOptions = {
autoSize: true,
layout: {
textColor: CHART_TEXT_COLOR,
background: { type: 'solid', color: CHART_BACKGROUND_COLOR },
},
yieldCurve: {
baseResolution: 1,
baseResolution: 12,
minimumTimeRange: 10,
startTimeRange: 3,
},
Expand All @@ -55,6 +56,9 @@ const chartOptions = {
visible: false,
},
},
timeScale: {
minBarSpacing: 3,
},
};

const container = document.getElementById('container');
Expand Down

0 comments on commit 8b2a7fd

Please sign in to comment.