0

I am in the process of writing a program in c# (I am using c# because it's a language that I want to learn now), and I want the following features :

  • plot data from a .csv file, which will look something like the picture enter image description here

  • in particular I want to be able to chose the font of the labels, color of dots, etc.

  • once the data is plotted from the csv file, have an interface that will allow small adjustments, for example move a label around, or add a line between chosen dots

  • be able to export a pdf out of the chart (or potentially more charts).

So I am creating a Windows application Form which would provide the interface, load the .csv file and parse it. This is fine.

I was wondering what experimented people would suggest for creating the chart and be able to manipulate it (the small interface that I was mentioning above). I saw the chart class of c#, would that be enough ? In particular, would that allow me to interact with the chart, and change my labels ?

Any recommendation is appreciated, thank you!

redfiloux
  • 113
  • 6
  • 1
    I recommend that you go ahead and try the chart class, and if it doesn't do everything you need, try google to find a third-party solution. If you can't find anything suitable, write your own. – 15ee8f99-57ff-4f92-890c-b56153 May 25 '18 at 15:39
  • 1
    The tasks you mention can be achieved with MSChart, charttype.line plus markerstyle.circle . For moveable labels use textannotations. You can save to xml and to png or vector formats which you can import to pdf.. There are examples of [moving points](https://stackoverflow.com/questions/36690301/how-to-drag-a-datapoint-and-move-it-in-a-chart-control/36715261?s=1|73.3976#36715261) or [selecting](https://stackoverflow.com/search?q=user%3A3152130+chart+select+) them. Colors of lines or dots can be set individually. – TaW May 25 '18 at 16:11
  • 1
    For more detailed advice one would have to see the csv data; do ask when you run into issues! – TaW May 25 '18 at 16:18
  • Thank you both, I'll start with this class then. Thanks @TaW for pointing that post also, sounds close to the feature I need! – redfiloux May 25 '18 at 16:23
  • @TaW I ran into some issues, for which I couldn't find a fix. 1) I didn't find a good way to draw a bunch of segments (as it's not a continuous line, but discontinuous segments). For example I could create a new series for each segment, but eh. Or have it be continuous and have every other one be transparent, but again, kinda ugly. 2) I didn't find a way to hide the label of a point, just erase it. -- I am just scared of finding more and more inconveniences as I keep using Chart, so I was thinking of making it from scratch... – redfiloux Jun 04 '18 at 12:52
  • You are right about 1). The lines in a series are continious and to sparate them you need a transparent point. Wrt 2): you can add the lables to points individually. But all in all tweking a chart so some very specific look and behaviour can be work and distracting. - With a suitable intermdiate model it may well look a lot better, depending on the details- But building from scratch will not come for free either.. – TaW Jun 04 '18 at 12:57
  • @TaW thanks. I'm still unsure with which method to go so I'll keep pushing. Since it's mostly for learning purposes, it's not really dramatic though... – redfiloux Jun 04 '18 at 13:03
  • Sure, good luck! - Btw: One can insert an emf chart file into a word document and save it as pdf. – TaW Jun 04 '18 at 14:20

0 Answers0