Draw boxes and text on c# MS Charting control - c#

i'm using MS Chart control on my WinForms app and having candlestick series with data.
I'm trying to find a way how to draw rectangles/boxes on a specific location (wrapping a couple of candlesticks).
I tried using annotations but it can't work in my case (it stays same size when zooming in/out).
Also tried with new RangeBar series, but it's not compatible with candlestick series.
There is also problem that all series must have same number of points, else it will throw an exeption.
Any idea how this can be made?

Related

OxyPlot - Is there any way to hide data points?

I'm using WPF and OxyPlot and I wanted to hide some points on a series... however this doesn't seem to be possible to my surprise! Am I missing something? I am iterating over a set of points on a series, and I'm concentrating on a specific region of the graph of the series where I want the data points outside that range to not display.

How do I style the Plot Bands for a graph in a telerik report using Visual Studio?

I have recently been brought on to a project that uses Kendo UI controls and Telerik Reporting reports to display various charts and graphs.
There is an existing Kendo UI Chart widget that displays a student's 'score' across the months of current and past school years. The score ranges from 0 to 100. The Y-Axis represents the 'score' and the X-Axis represents the School Year/Month.
In addition, the 0 to 100 scale of the Y-Axis is broken down into rankings: 65-70 = poor, 71 - 80 = fair, etc. This ranking is displayed via different colored Plot Bands on the Y-Axis in the Kendo UI Chart. The Plot Bands are configured using custom C# code to establish the To, From, Color and Opacity properties of each Plot band for the value series.
Here is the code:
var thresholds= _[*entity framework call to generate database driven values*];
List<PlotBand> plotBands = new List<PlotBand>();
foreach (var threshold in thresholds)
{
plotBands.Add(new PlotBand()
{
From = threshold.Min,
To = threshold.Max,
Color = threshold.RiskColor.ColorCode,
Opacity = .3
});
}
This works as expected and generates a Kendo UI Chart that appears like this:
kendo ui chart
I have been asked to duplicate the chart in a Telerik Reporting report. I'm using Visual Studio 2013 Pro and designing the report from inside VS (i.e. not using the stand alone designer) with the Telerik Reporting Q1 2015 SP1 version.
Yes, i know these are not the latest, but it's what I was given....
The Telerik Reporting Graph control and the Kendo UI Chart widgets are similar but not identical. I can re-create 90% of the chart using the graph control. The only portion missing is the color-coded ranking that displays as the background to the chart. There does not seem to be any analogous properties for the Chart's Plot Bands within the Graph control.
I've tried creating a secondary coordinate system and using multiple Cross Axis positions as described by Telerik here. That allows me to create the psuedo-plot bands but not style them. I cannot find any property in the Graph control, or any of its components, that allows me to set the color or opacity for each plot band.
Any ideas? Is this even possible?
Actually there is a very recent KB article that explains how to do that - as you've guessed, it requires an additional series and coordinate system. You can check it here: https://docs.telerik.com/reporting/knowledge-base/how-to-create-plot-bands-using-the-graph-item.
About the colour opacity: Try setting the colours using the ARGB values directly, like 128;64;64;64 - this should be a transparent grey-ish colour.

How to draw graph using chart in .net windows forms based on time(seconds)

My requirement is to draw a graph using chart control in .net(windows form or WPF) in c# or vb.net which will update data from a serial port.The graph should show the received data and plot the load value(y axis) against time(x axis).The interval should be in seconds and it should keep on moving to the left like in ECG or Oscilloscope.
I made the graph but it is not scaling for second intervals and not moving and redrawing to the left.
I don't think there is a built in chart function.
I guess you need to split this up.
>Make an array, to hold some data points.
>Then use a timer, and the OnTimerEvent method, to put the next data point in the array, and move along, deleting the last one.
>and then refresh--delete and add--all the chart data points from the array values
Timer:
http://msdn.microsoft.com/en-us/library/393k7sb1(v=vs.110).aspx
Sorry I can't think of a simple way

Draw custom marker on WPF Toolkit Chart

I have simple (x,y) graph using WPF Toolkit DataVisualisation Chart.
This is Area chart but could be line or box.
I need to show on the chart - which data point was updated last. I'd like to draw a line or show a thick gridline for that data point.
What can be done to achieve it?
I had to change code in the toolkit classes. after 4 hours of getting throught the khaos of the inheritance I finally made by adding some code into : OrientedAxisGridLines (to draw the line), LinearAxis (to calculate pixel position for the line), DataPointSeriesWithAxes (to have dep prop to bind to the user data).
The code is awkward and is written to get job done so I am not sharing it.
If there will be those who wants to see it - leave the comment I might do it later...

Display unsorted data in SL3 line chart

I'm having trouble with my Silverlight Chart. My model is unsorted, that is, the sorting is done on the server side. It needs to support year transitions, but as you can see from the screenshot the charting control automatically sorts the model and fills in the gaps. The line sort be ever increasing and not taking a dip on new year.
How can I make the chart display the data in the order specified in the grid control to the left?
Btw, using SL3
alt text http://img705.imageshack.us/img705/7602/unsortedsilverlightchar.png
The line chart is not designed to do the task you seem to be asking. After all the purpose of a line chart is to help the user trace a trend or even visually interpolate an interim value. However if the interval between horizontal points is not linear and always traveling in the same direction such lines meaningless.
I would therefore suggest that the Line chart is not appropriate or that you have some other hidden data which should be used for the Y-axis which would make the lines meaningful.
Alternatives might be to use a Scatter graph or a Column series where the y-axis value has been converted to a string and thus cause the series to use a Category based axis instead of range based one.

Categories

Resources