Chart with 30 lines

Share RGraph:   Share or Like RGraph on Facebook!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by jlost55 on 5th May 2014
Hi there,

var line = new RGraph.Line('myCanvas', [...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...],[...]).draw();


I tried to draw a graph with 30 lines. With this code, I see only the first 10 lines. Is this normal?

Posted by Richard on 5th May 2014
Hi,

It's probably running out of colors. Here's a line chart with 30 lines nd also setting the colors option to 30 blacks:

www.rgraph.net/fiddle/view/a-line-chart-showing-30-lines
Posted by jlost55 on 5th May 2014
Hi,

I found also a solution for my problem. They are standard 10 colors. When I changes it in 30 colors, I saw my chart with 30 lines.

Thanks :)
Posted by jlost55 on 5th May 2014
with 'labels.ingraph', I see one label per each line.

Is there a solution to give a label to the another 29 lines?
Posted by Richard on 5th May 2014
Hi

Yes you can give labels to the other lines. The array is sequential though, so you can use null values for the points you don't want to give a label to or use the shorthand notation like this:

www.rgraph.net/fiddle/view/a-line-chart-showing-30-lines
Posted by jlost55 on 5th May 2014
Ok, what is difference between labels.ingraph and tickmarks?

I will more like this because I will give a name for each line: www.rgraph.net/docs/ingraph.html
Posted by Richard on 5th May 2014
Hi

labels.ingraph are labels, whilst tickmarks are just notches/markers on the line.
Posted by jlost55 on 5th May 2014
Have you sometimes a good example with tickmarks? I don't understand how it works.
Posted by Richard on 5th May 2014
Hi

Just set this:

obj.set('tickmarks', 'circle');
Posted by jlost55 on 6th May 2014
Hi there,

Is it possible to create with tickmarks like this: www.dropbox.com/s/vcy0cre9ff5o3ru/zindex.PNG?

I will only show a name (-10%, -8%, -6%, ...) by the line.
Posted by Richard on 6th May 2014
Hi

The lines do not have any tickmarks. If that's what you want just set the tickmarks to null:

obj.set('tickmarks', null);
Posted by jlost55 on 6th May 2014
Hi,

I think that you don't understand me.

The important thing of my problem is the labels on the rightside and upside on the chart. (red number with a square). I will create like this.

In my previous project, I created for each line a graph. With that I can give with labels.ingraph a label for each graph and also for one line.

Now, I create 1 chart with 30 lines (it's better than my previous project). But I have one problem, I will also the labels on my new chart.
Posted by Richard on 6th May 2014
Hi

Can't tell what you want entirely - but if you want a single label for each line. positioned on the line like in the picture, I think you will need to use the drawing API text object in-conjunction with the line chart coords2 array. like this example:

www.rgraph.net/fiddle/view/a-line-chart-showing-the-drawing-api-text-object
Posted by jlost55 on 6th May 2014
Hi there,

That's a very good solution. It works all on the rightside of the chart.

Is it possible to draw the labels upside the chart. Because my lines stopped also upside of my chart.

Link: www.dropbox.com/s/vcy0cre9ff5o3ru/zindex.PNG
Posted by Richard on 6th May 2014
Hi

Just use Math.max(coordY, 10) on the Y coordinate - if it's less than (eg) 10, use 10 instead.
Posted by jlost55 on 6th May 2014
Hi there,

It's difficult to calculate the X coordinate for the labels because my lines stopped always on an another position.
Posted by Richard on 6th May 2014
Hi

Then you'll need to go through all of the coordinates until you reach one where the Y value is less than a certain desired point and then use the previous set of X/Y coords.




Richard
Posted by jlost55 on 6th May 2014
Hi,

With your tips I've found my problem.

Thanks :)

Add a reply




« Back to message list