Welcome Guest Search | Active Topics |

Draw lines in a chart
handelcamilo
#1 Posted : Thursday, April 19, 2012 9:52:59 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/19/2012(UTC)
Posts: 5

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Hi again,
I'm very happy with jqChart and you guys are doing a great job with it.

I need to know if there's a way to draw some free line inside a chart(not line series).

Thanks!
Dragan
#2 Posted : Friday, April 20, 2012 4:27:35 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Hi,

Can you provide us a little more info about what kind of lines you want to draw? We can probably include such functionality in the jqChart.
Best Regards,
Dragan Matek
jqChart Inc.
handelcamilo
#3 Posted : Friday, April 20, 2012 6:48:39 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/19/2012(UTC)
Posts: 5

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
It's like trend lines. The users of a financial chart need to draw some trend lines to check if a a stock is raising or falling..

Like this example http://www.amcharts.com/...ck/drawing-trend-lines/ but beyond to draw a line maybe the users need to draw a circle, rect, and fibonacci retracement( http://www.swing-trade-s...iles/fibonaccichart.png ) on the stock chart.

Thanks!
Pooya
#4 Posted : Saturday, April 21, 2012 1:16:33 AM(UTC)
Rank: Member

Groups: Registered
Joined: 9/17/2011(UTC)
Posts: 23

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Hi,

A Seperate plugin to enable drawing in charts make jqChart unbeatable product. Custom (user defined) Drawing tools and shape (to create fibonacci or ...) is another great bonus.

Thanks
PooyaParidel
Dragan
#5 Posted : Saturday, April 21, 2012 7:04:17 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Thanks for the suggestions.

We’re discussing how to include this in the jqChart. We have plans for adding interactive annotations in the chart, which I believe is pretty the same as your proposals.
Best Regards,
Dragan Matek
jqChart Inc.
Vince
#6 Posted : Wednesday, April 24, 2013 3:13:54 AM(UTC)
Rank: Member

Groups: Registered
Joined: 4/24/2013(UTC)
Posts: 16

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Are there any updates for this? Drawing would be a very interesting functionality for me, since I haven't yet found a chart-API which provides this in addition to some other criteria.
Dragan
#7 Posted : Wednesday, April 24, 2013 3:00:30 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Currently we still don't fully support annotations. Here is an example how you can add a vertical line on mouse click:

Code:
   <script type="text/javascript">

        function addDays(date, value) {
            var newDate = new Date(date.getTime());
            newDate.setDate(date.getDate() + value);
            return newDate;
        }

        function round(d) {
            return Math.round(100 * d) / 100;
        }

        var data1 = [];
        var data2 = [];

        var yValue1 = 50;
        var yValue2 = 200;

        var date = new Date(2010, 0, 1);

        for (var i = 0; i < 200; i++) {

           yValue1 += Math.random() * 10 - 5;
            data1.push([date, round(yValue1)]);

            yValue2 += Math.random() * 10 - 5;
            data2.push([date, round(yValue2)]);

            date = addDays(date, 1);
        }

        $(document).ready(function () {

            var background = {
                type: 'linearGradient',
                x0: 0,
                y0: 0,
                x1: 0,
                y1: 1,
                colorStops: [{ offset: 0, color: '#d2e6c9' },
                             { offset: 1, color: 'white' }]
            };

            $('#jqChart').jqChart({
                title: 'Chart Title',
                legend: { title: 'Legend' },
                border: { strokeStyle: '#6ba851' },
                background: background,
                tooltips: { type: 'shared' },
                shadows: {
                    enabled: true
                },
                crosshairs: {
                    enabled: true,
                    hLine: false,
                    vLine: { strokeStyle: '#cc0a0c' }
                },
                axes: [
                        {
                            type: 'dateTime',
                            location: 'bottom',
                            zoomEnabled: true,
                            plotLines: []
                        }
                ],
                series: [
                            {
                                title: 'Series 1',
                                type: 'line',
                                data: data1,
                                markers: null
                            },
                            {
                                title: 'Series 2',
                                type: 'line',
                                data: data2,
                                markers: null
                            }
                ]
            });

            var selectedDate = null;

            $('#jqChart').bind('dataHighlighting', function (e, data) {
                if (data) {
                    selectedDate = data[0].x;
                }
                else {
                    selectedDate = null;
                }
            });

            $('#jqChart').bind('mousedown', function (e, data) {

                if (!selectedDate) {
                    return;
                }

                var axes = $('#jqChart').jqChart('option', 'axes');
                axes[0].plotLines.push({ value: selectedDate, strokeStyle: 'red' });


                $('#jqChart').jqChart('update');
            });
        });
    </script>
</head>
<body>
    <div id="jqChart" style="width: 500px; height: 350px;">
    </div>
</body>
Best Regards,
Dragan Matek
jqChart Inc.
Vince
#8 Posted : Thursday, April 25, 2013 1:30:12 AM(UTC)
Rank: Member

Groups: Registered
Joined: 4/24/2013(UTC)
Posts: 16

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
Great, thank you. I think, I can use that snippet for further improvements and build a "drawing-api" myself then.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.111 seconds.