-2

In this question: Previous DyGraph question

There is still the need to go to JavaScript to call DyGraph:

<script type="text/javascript">
g = new Dygraph(document.getElementById("readingGraph"), @data,{ labels: ["Sample Number", "Reading"] });
</script>

Is there anyway to remove JavaScript completely?

I would like a fully c# solution...

ManInMoon
  • 6,795
  • 15
  • 70
  • 133
  • I mean, you could use C# to write JavaScript to the output stream... But at some point it starts getting a little silly. You're interacting with a JavaScript component; embrace the madness ;). – Heretic Monkey Mar 05 '20 at 14:50

2 Answers2

2

Ah, OBVIOUSSLY not. DyGraph is a javascript library. If you want to remove Javascript completely, you need to use a graph library that generates the graph on the server and sends the picture down to the client. Given that DyGraph is a javascript library - the obvious answer is no, it can not be used while at the same time totally disabling javascript.

Literally on the homepage it says: "dygraphs is a fast, flexible open source JavaScript charting library.".

TomTom
  • 61,059
  • 10
  • 88
  • 148
  • I see. I was hoping for a "Wrapper" to use within the c# body. Is there a Client-side c# based plotting package that would give easier functionality? – ManInMoon Mar 05 '20 at 14:57
  • Ah, we do not recommend software and tools here. – TomTom Mar 05 '20 at 15:00
  • You don't need to generate an image on the server. You can generate svg with Blazor, or generate an image and then put it into a canvas. – Andrew Rondeau Apr 27 '22 at 17:41
0

If you want 100% C# and no Javascript, MudBlazor has some charting capabilities: https://mudblazor.com/components/barchart#api

As another answer states, "Given that DyGraph is a javascript library - the obvious answer is no, it can not be used while at the same time totally disabling javascript"

Andrew Rondeau
  • 667
  • 7
  • 18