I have a couple of questions about some Scatter chart issues


« 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 sh2sg on 25th January 2013
Hi,

Couple of questions regarding scatter chart.

1. How to put Y axis labels at Y axis' right side? Y axis itself is left side. Reason for doing this is, data are dynamic, could be very long eg 12345.6789. I can't reserve gutter.left as label length is unknown.

2. chart.filled and chart.fillstyle are not working for scatter chart.

3. default label font size is too small on high DPI screen, but if I increase font size, labels will overlap X axis.

Thanks
Posted by RGraph support on 25th January 2013
Hi there,

1. For this you can use chart.yaxispos, and set it to right eg:

obj.Set('chart.yaxispos', 'right');

If you mean you want the labels on the right hand side of the Y axis - this isn't supported by the Scatter chart. What you can do though if you potentially have long labels is set chart.scale.decimals to 1 or 2 and then use tooltips (or even the chart.events.mousemove option) to show the longer, exact, figure. Or perhaps the chart.labels.above option depending on how dense your scatter marks are.

2. That's because filled lines aren't supported on the Scatter chart.

3. Which labels - the Y axis labels? With the tooltip option you can use CSS to style your tooltips - specifying a bigger font:

<style>
     .RGraph_tooltip {
         font-size: 16pt ! important
     }
</style>

If on the other hand you mean X labels, one way to give yourself extra room is to use two lines:

obj.Set('chart.labels', ['Label on first line','\r\nLabel on second line' ... ]);


  

Richard, RGraph Support
Posted by Enter your name... on 25th January 2013
Hi,

Thanks for the reply.

1. Yes I meant labels on the right hand side of Y axis, while Y axis is still at left of side of chart. This way I don't need to set or adjust gutter.left.

chart.scale.decimals can't help on Y axis data like 12345678 vs 0.1.

tooltip is a bit laggy on touch screen decives.

3. X axis label. Thanks for the tip, it uses \n for line break, I tried '<br>' but it shows <br>...

One more question, anyway to evenly print X axis labels? Say I have 100 data, I only want 5 labels to be shown on X axis else X axis will be too crowded, I want to display 1st one (left align), last one (right align), and other 3 evenly ones (center align)...
Posted by RGraph support on 25th January 2013
Hi there,

> One more question, anyway to evenly print X axis labels? Say I have 100 data, I
> only want 5 labels to be shown on X axis else X axis will be too crowded, I want
> to display 1st one (left align), last one (right align), and other 3 evenly ones
> (center align)...

The Scatter chart are shown in "sections" - so if you have 5 labels then divide your chart into 5 sections - then each label will be centered in each section. If you want the labels to be displayed using the same style as the Line chart - you will need to use the DrawXAxis() API function, which incidentally is being changed to a draswing API object next month to make it easier to use.

For now you'll need to add an ondraw event listener and use the DrawXAxis() function within that:

obj.ondraw = function (obj)
{
     RGraph.DrawXAxis(obj, {...});
}


  

Richard, RGraph Support
Posted by Enter your name... on 25th January 2013
Thanks Richard. No need to call DrawXAxis, I set Scatter's X axis labels as something like:

Scatter.Set('chart.labels',[
   ["Text 1", timestamp1],
   ["Text 2", timestamp2],
   ["Text 3", timestamp3],
]);

Where timestampX are from data array, this way I can display any text label at any point, just a little bit tedious work to evenly divide all data serials and choose the right timestamps, bu no way to align label text for individual label. I am lazy so I was asking if Scatter chart has builtin support for such X axis label display.

Hope Scatter chart can support filled lines and more animation effects.
Posted by Charles on 20th May 2013
Is there a simple way to implement www.rgraph.net/demos/drawing-api-xaxis-basic.html graph without using external links.? . if so please let me know. as iam using rickshaw graph i need this same y-axis coordinates on top of the graph. thanks in advance
Posted by RGraph support on 20th May 2013
Hi there,

The demo is already very simple and doesn't use any external links.



Richard, RGraph Support

Add a reply




« Back to message list