i drawing line on graph numbers read text file. there number on each line of file corresponds x co-ordinate while y co-ordinate line on.
the requirements have changed include "special events" if number on line followed word special spike appear image below:
currently way can find use line each spike, there large of these special events , needs modular. seems efficient , bad way program it.
is possible add spikes same graph line? or possible use 1 additional line , have broken (invisible) , show spikes meant seen?
i have looked @ using bar graphs due other items on graph cannot.
the datapoints
of line
chart
connected not possble break apart. each segment leading datapoint
can have own color , includes color.transparent
lends simple trick..
without adding series
or annotations
, 2 questions can solved this:
to add 'spikes' show in 2nd graph, need insert 2 suitable datapoints, 2nd being identical point spike connected to.
to add unconnected line need 'jump' beginning adding 1 point transparent color.
here 2 example methods:
void addspike(series s, int index, double spikewidth) { datapoint dp = s.points[index]; datapoint dp1 = new datapoint(dp.xvalue + spikewidth, dp.yvalues[0]); s.points.insert(index+1, dp1); s.points.insert(index+2, dp); } void addline(series s, int index, double spikedist, double spikewidth) { datapoint dp = s.points[index]; datapoint dp1 = new datapoint(dp.xvalue + spikedist, dp.yvalues[0]); datapoint dp2 = new datapoint(dp.xvalue + spikewidth, dp.yvalues[0]); datapoint dp0 = dp.clone(); dp1.color = color.transparent; dp2.color = dp.color; dp2.borderwidth = 2; // optional dp0.color = color.transparent; s.points.insert(index + 1, dp1); s.points.insert(index + 2, dp2); s.points.insert(index + 3, dp0); }
you can call them this:
addspike(chart1.series[0], 3, 50d); addline(chart1.series[0], 6, 30d, 80d);
note add 2 or 3 datapoints points collection!
of course can set color , width (aka borderwidth) of lines wish , include them in params list..
if want keep points collection unchanged can create 1 'spikes series' , add spike points there. trick 'jump' new points transparent line!