Skip to content
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

Gradient fill for line type chart #1530

Closed
OstapchelaEst opened this issue May 20, 2024 · 2 comments
Closed

Gradient fill for line type chart #1530

OstapchelaEst opened this issue May 20, 2024 · 2 comments

Comments

@OstapchelaEst
Copy link

OstapchelaEst commented May 20, 2024

When selecting a linear type of graph I want to make a gradient fill as in one of the examples.
image

But something goes wrong and I get this result and I can't fix it
image

Here's my code
https://jsfiddle.net/0awzmqot/2/

@martynasma
Copy link
Collaborator

If you need LineSeries fill to go to the axis line, you need to remove openValueYField from its settings, or otherwise it will fill to the open value rather than zero line.

  var series;
  switch (seriesType) {
    case "line":
    	delete newSettings.openValueYField;
      series = mainPanel.series.push(am5xy.LineSeries.new(root, newSettings));
      series.fills.template.setAll({
        visible: true,
        fillOpacity: 0.2
      });   
      break;
    case "candlestick":
    case "procandlestick":
      newSettings.clustered = false;
      newSettings.openValueYField = "Open";
      series = mainPanel.series.push(am5xy.CandlestickSeries.new(root, newSettings));
      if (seriesType == "procandlestick") {
        series.columns.template.get("themeTags").push("pro");
      }
      break;
    case "ohlc":
      newSettings.clustered = false;
      newSettings.openValueYField = "Open";
			series = mainPanel.series.push(am5xy.OHLCSeries.new(root, newSettings));
      break;
  }

Copy link

This issue is stale because it has been open 30 days with no activity. It will be closed in 5 days unless a new comment is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants