question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Detailed example for ApexRangeSeries

See original GitHub issue

Hejsån! Great charts, just wish there would be more detailed examples somewhere and wider audience for keeping this repo alive and actively maintained. I have got majority of examples working, but can’t figure out how you managed ApexRangeSeries functioning.

I have seen documentation: https://apexcharts.github.io/Blazor-ApexCharts/rangebar-charts

Basically I am trying to imitate GanttChart with this chart, so I came up with this model:

    protected async override Task OnInitializedAsync()
    {
      this.ProjectsList = await this.HttpClient.GetFromJsonAsync<IEnumerable<Project>>("api/Projects");

      this.InitializeGanttChartOptions();

      this.GanttChart = this.ProjectsList
      .Select(s => new GanttChartModel
      {
        XAxisValue = s.Name,
        YAxisValue = new List<decimal> { s.ProjectStartDate.Ticks, s.ProjectEndDate.Ticks },
      }).ToList();
    }

Then razor part:

  <ApexChart TItem="GanttChartModel"
           Title="Gantt view"
           Options=Options
           XAxisType="XAxisType.Datetime">
    <ApexRangeSeries TItem="GanttChartModel"
                   Items="this.GanttChart"
                   XValue="@(e => e.XAxisValue)"
                   YValue="@(e => e.YAxisValue)" />
  </ApexChart>

So at this point YValue is decimal, but for getting range it should be public IEnumerable<decimal> YAxisValue { get; set; }. How to get it working?

My model:

  public class GanttChartModel
  {
    public object XAxisValue { get; set; }
    public IEnumerable<decimal> YAxisValue { get; set; }
  }

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
joadancommented, Jan 18, 2022

I have now added the option to set YMin/Max value on the ApexRangeSeries. Check it out at https://apexcharts.github.io/Blazor-ApexCharts/rangebar-charts#date range . There is a new nuget version 0.6.1-alpha.

Formatting Datetime X Axis is described here, https://apexcharts.com/docs/datetime/ Docs for the X-Axis options, here https://apexcharts.com/docs/options/xaxis/

For the dynamic height I guess you should be able to set the the height on the chart calculated from the number of items in the list.

Please let me know if there are questions.

0reactions
joadancommented, May 14, 2022

Clean up

Read more comments on GitHub >

github_iconTop Results From Across the Web

Retrieve DateTimeOffset pairs from linq query
I have an example that is working. However in real world scenario I am getting data from linq query. How to receive data...
Read more >
Newest 'apexcharts' Questions - Stack Overflow
I've create ASP.Net core solution and some details of item will be displayed in bootstrap modal as chart (apexChart library). Chart appear ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found