<graph> element usage, CMlGraphCurve::Style ?

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
reaby
Posts: 956
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

<graph> element usage, CMlGraphCurve::Style ?

Post by reaby »

Hi,

I've seen <graph> can do lines, but GraphCurve suggest that it could do bezier as well...
  • What are the possible values for the Style attribute ?
  • Can <graph> hold possible <curve> values ?
Something like:

Code: Select all

<graph min="0 0" max="100 100">
       <curve color="fff" width="0.1">
	       <point pos="0 0" />
               <point pos="0 10" />
      	</curve>
</graph>
or what is the right syntax, as there's so little infos for this manialink element :)

**edit**
changed topic title, so it's easier to find the info from future searches.
Last edited by reaby on 05 Apr 2019, 12:35, edited 1 time in total.
cgdb
Nadeo
Nadeo
Posts: 16
Joined: 23 Oct 2018, 12:33

Re: CMlGraphCurve::Style

Post by cgdb »

Hello,

I'm not an expert of this topic, but some infos I have found :
- The points use a "coords" attribute, not "pos".
- A curve seems to only describe a y=f(x) described function, which means that the points should be sorted from lowest to highest x-coordinate and no pair of points can share the same x-coordinate.
- The style attribute seems to have an effect only on the curve width :
* If left empty, width is described in Ml units.
* If set to "thin", width is described in pixels.
* I have seen someone saying the style can be set to "surface", this is correct but the internal logic of this style is broken.
- You can have multiple curves on the same graph, each with their own color, style, etc...

You can also manipulate a graph and its curves using Maniascript, check the CMlGraph and the CMlGraphCurve API.

Here is a bit of Manialink I made to check these infos, you can copy it to test it yourself.

Code: Select all

<graph size="50 50" min="0 0" max="10 10">
	 <curve color="00f" width="1" style="thin">
		<point coords="0 0" />
		 <point coords="10 10" />
	</curve>
	<curve color="f00" width="1">
		<point coords="0 10" />
		 <point coords="5 0" />
		 <point coords="10 10" />
	</curve>
</graph>
And attached the resulting curves in my Interface Designer.
Attachments
CMlGraphCurveTest.png
CMlGraphCurveTest.png (101.58 KiB) Viewed 1327 times
reaby
Posts: 956
Joined: 29 Dec 2010, 23:26
Location: Eastern Finland
Contact:

Re: CMlGraphCurve::Style

Post by reaby »

Hi cgdb,

The element has been a mystery for me for a quite a while and I was re-discovering the possibilities lately. I was kind of hoping it could do also curves and fills... But this new infos helps to draw much more easily graphs from manialink as the only known way by this far was to generate maniascript into manialink to draw the lines. Graph is very useful for histograms or to visualize some valuedata from maniascript or from server contorller :)

Many thanks for a fast reply and detailed answer,
Reaby
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest