Failing to plot a simple List<double> with 8760 points as a line chart
See original GitHub issueHello guys,
I just came across this library, this is fantastic, thanks for the work! I’ve succeeded in creating really complex graphs with so few lines of code that now I want to convert all my graphs! Here goes some examples:
and this is all the code I wrote:
<ApexCharts.ApexChart TItem="Zone"> <ApexCharts.ApexPointSeries TItem="Zone" Items="building.Zones.Where(x => x.REVITOccupation > 0)" SeriesType="ApexCharts.SeriesType.Pie" XValue="@(e => e.REVITSpaceKey)" OrderBy="@(e => e.X)" YAggregate="@(e => e.Sum(e => e.REVITOccupation))" /> </ApexCharts.ApexChart>
That’s incredible. My previous library would require me to write code in WASM and in C#… Thanks again for the porting.
But the reason I’m writing is that I can’t seem to be able to create the most simple kind of graph, a List of doubles. I am trying to do something like this:
and i was expecting the code to be as short as the last one, so I wrote the following:
<ApexCharts.ApexChart TItem="double"> <ApexCharts.ApexPointSeries TItem="double" Items="@this.BuildingInUse.Heat.Space.Hourly" SeriesType="Apex.SeriesType.Line" YValue="@(e => e)" Name="Space Heating" /> </ApexCharts.ApexChart>
where the Item supplied is of type List<double>
. I can’t compile it, says that my YValue needs to be of decimal type.
I’ve looked in the documentation, but there are no examples of how to deal with a large dataset of 10.000 points, for example. Any help would be appreciated.
Issue Analytics
- State:
- Created 8 months ago
- Comments:8 (4 by maintainers)
Top GitHub Comments
Hello,
Thank you for the repo.
The bulk of the time is for the browser to render the chart. it has nothing to do with the wrapper. Apexchart is svg based this means that every object is an SVG node and if the number of nodes is high then it takes a long time for the browser to render the chart. I turned of XAxis labels and ticks in your sample and was able to get a much better response.
However I think you should really consider if you have to render so many points at the same time. It hard for anyone to make something out of that chart. Would it be an option to group the data?
Hey there joadan,
It took me quite some time but, as promised, I got back to you, and this time with all the sauce so you can test it on your side. I’ve created a little repo showing a page taking never less than 30 seconds to load a line graph with 8760 points. Here is the repo:
https://github.com/sweco-bepema/ApexChartTest