Dynamic RGraph

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« 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 Islam on 17th May 2016
Greetings I'm Trying to make a page in Which I Change the chart based on the click of three buttons,
also The Values and Labels Come From HiddenFields,
But I Have 2 Problems,
1)The Linear Chart Goes Below the horizontal line.
2)The Labels Aren't Aligned With the Dots in the Line.

This is my Code For the Line Chart From Code Behind:

             ChartDrawLiteral.Text= @"<script>
window.onload = function () {

                     var dataset1 = [" + HiddenField_EvaluationValue.Value + @"];
                     var dataset2 = [" + HiddenField_CumulativeValue.Value + @"];
                     var dataset3 = [" + HiddenField_TargetMaxRange.Value + @"];

                     var bar = new RGraph.Bar({
                         id: 'Cvs1',
                         data: [dataset3],
                         options: {
                             colors: ['#ddf'],
                             ylabels: false,
                             backgroundGridVlines: false,
                             backgroundGridBorder: false,
                             textSize: 14,
                             strokestyle: 'rgba(0,0,0,0)'
                         }
                     }).grow()

                 var line = new RGraph.Line({
         id: 'Cvs1',
         data: [dataset1, dataset2],
         options: {
             spline: true,
             linewidth: 3,
             hmargin: 5,
             labels: [" + HiddenField_PeriodNames.Value + @"],
                             tooltips: [dataset1, dataset2],
                             tickmarks: 'circle',
                             ticksize: 5,
                             textAccessible: true
                         }
                     }).trace2();
                 };
</script>";
Posted by Richard on 17th May 2016
Hi there,


> 1)The Linear Chart Goes Below the horizontal line.

What horizontal line? Put the chart or a picture of the chart on the Internet so that I can see what it is that you're referring to - otherwise I don't know. An annotated chart would be very helpful.

> 2)The Labels Aren't Aligned With the Dots in the Line.

Again, a picture of what you're referring to would be very helpful.


BTW this:

labels: [" + HiddenField_PeriodNames.Value + @"],

probably doesn't quote the values correctly. View source in your browser to see what the result is. It needs to look something like this (with quotes around each label):

...
labels: ['Bob','Fred','Luis','Jim','Neil'],
...






Richard

Add a reply




« Back to message list