I'm using microsoft Chart control in my web form. I want points(0, 0) should be bold on the chart. My code is as follows:
DataTable dt = collection.ToDataTable();
// Chart1.Series[0].Points.DataBind(collection, "Price", "OverallQuality", "Label=HotelName");
for (int i = 0; i < dt.Rows.Count; i++)
{
Chart1.Series.Add("series" + i);
Chart1.Series["series" + i].ChartType = SeriesChartType.Point;
// Chart1.Series["series" + i].Points.AddXY(double.Parse(dt.Rows[i]["Price"].ToString()), double.Parse(dt.Rows[i]["OverallQuality"].ToString()));
Chart1.Series["series" + i].Points.AddXY(double.Parse(dt.Rows[i]["OverallQuality"].ToString()), double.Parse(dt.Rows[i]["Price"].ToString()));
Chart1.Series["series" + i].MarkerSize = 10;
Chart1.Series["series" + i].LegendText = dt.Rows[i]["HotelName"].ToString();
}
// Chart1.ChartAreas[0].AxisX.Title = "Price";
// Chart1.ChartAreas[0].AxisY.Title = "Quality";
Chart1.ChartAreas[0].AxisX.Title = "Quality";
Chart1.ChartAreas[0].AxisY.Title = "Price";
Chart1.ChartAreas[0].AxisX.Maximum = 10;
Chart1.ChartAreas[0].AxisX.Minimum = -10;
Chart1.ChartAreas[0].AxisX.Interval = 1;
Chart1.ChartAreas[0].AxisY.Maximum = 10;
Chart1.ChartAreas[0].AxisY.Minimum = -10;
Chart1.ChartAreas[0].AxisY.Interval = 1;
Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray;
Chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray;
}
Have you tried changing the PointWidth of the series?
Chart1.Series["series"]["PointWidth"] = "0.2";
You can find a bunch of examples of manipulating this property, such as this. But the trick, for your situation, is dealing with the fact that you can only manipulate this property for the entire series. This post leads me to believe you will have problems setting it for just this particular point, unless you can separate is into it's own somehow. Here's an exmample from stack somewhat similar that might help, depending on how your information is formatted.
Related
I'm trying to find how to apply locale info to timelineMonth cols formatting.
Seems that dayNames, dayNamesShort, monthNames and monthNamesShort are not applied only to that specific view (see image)
timelineMonth
Is there a specific option to format that particolar rows?
The rest of the views (calendar-scheduler) month and names are correctly displayed using provided the arrays of day and month names
CalendarOptions options = new CalendarOptions();
options.dayNames = new JsArray<>();
options.dayNamesShort = new JsArray<>();
for (int i = 0; i < 7; i++) {
options.dayNames.setAt(i, DateTimeFormat.getWeekDay((i - 1) % 7));
options.dayNamesShort.setAt(i, DateTimeFormat.getCompressedWeekDay((i - 1) % 7));
}
options.monthNames = new JsArray<>();
options.monthNamesShort = new JsArray<>();
for (int i = 0; i < 12; i++) {
options.monthNames.setAt(i, DateTimeFormat.getMonth(i + 1));
options.monthNamesShort.setAt(i, DateTimeFormat.getCompressedMonth(i + 1));
}
Ok i've solved the issue by myself.
in timeline we have to manage such info by the slotLabelFormat opt, (Array)
https://fullcalendar.io/docs/slotLabelFormat
I'm trying to retrieve the Points of a SignaturePad to redisplay the signature.
public static void GetPoints(string airid, SignaturePadView padView)
{
List<Strokes> DBStrokes = SqLiteHelper.conn.Query<Strokes>("select * from Strokes where airid = ? order by PointSequence", airid);
List<Point> points = new List<Point>();
foreach (Strokes stroke in DBStrokes)
points.Add(new Point { X = stroke.pointx, Y = stroke.pointy });
padView.Points = points.AsEnumerable();
}
The array points is filled correctly, but the padView.Points shows as result
{Xamarin.Forms.Point[0]}.
I've found the Problem. It seems that it is only possible to set the Points property when the Signaturepad is visible. so my new code looks like this:
List<Strokes> DBStrokes = SqLiteHelper.conn.Query<Strokes>("select * from Strokes where airid = ? order by PointSequence", formField.pictFile);
Xamarin.Forms.Point[] points = new Point[DBStrokes.Count];
for (int i = 0; i < DBStrokes.Count; i++)
points[i] = new Point(DBStrokes[i].pointx, DBStrokes[i].pointy);
var originalPoints = JsonConvert.SerializeObject(points);
Xamarin.Forms.Point[] points4View = JsonConvert.DeserializeObject<Xamarin.Forms.Point[]>(originalPoints);
signatureView.Points = points4View;
Now i'm using the Handle_MeasureInvalidated - Event to run this code.
I'm converting audio by using the AudioToolBox.AudioConverter library.
AudioStreamBasicDescription inDescription;
inDescription.mSampleRate = 44100;
inDescription.mFormatID = kAudioFormatMPEGLayer3;
inDescription.mFormatFlags = 0;
inDescription.mBytesPerPacket = 0;
inDescription.mFramesPerPacket = 1152;
inDescription.mBytesPerFrame = 0;
inDescription.mChannelsPerFrame = 2;
inDescription.mBitsPerChannel = 0;
inDescription.mReserved = 0;
AudioStreamBasicDescription outDescription;
audioDescription.mFormatID = kAudioFormatLinearPCM
audioDescription.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagsNativeEndian;
audioDescription.mChannelsPerFrame = 2;
audioDescription.mBytesPerPacket = sizeof(SInt16)*audioDescription.mChannelsPerFrame;
audioDescription.mFramesPerPacket = 1;
audioDescription.mBytesPerFrame = sizeof(SInt16)*audioDescription.mChannelsPerFrame;
audioDescription.mBitsPerChannel = 8 * sizeof(SInt16);
audioDescription.mSampleRate = 44100.0;
This is the conversion part with mp3AudioData...
AudioBufferList *mp3Audio = (AudioBufferList *)malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer));
mp3Audio->mNumberBuffers = 1;
mp3Audio->mBuffers[0].mNumberChannels = 2;
mp3Audio->mBuffers[0].mDataByteSize = chunkLen;
mp3Audio->mBuffers[0].mData = calloc(chunkLen, sizeof(uint8_t));
memcpy(mp3Audio->mBuffers[0].mData, chunkData, chunkLen);
AudioStreamPacketDescription *packetDescription =
(AudioStreamPacketDescription*)malloc(sizeof(AudioStreamPacketDescription) * frames);
packetDescription->mDataByteSize = chunkLen;
packetDescription->mStartOffset = 0;
packetDescription->mVariableFramesInPacket = 1;
OSStatus result = AudioConverterFillComplexBuffer(audioConverter,
fillComplexBufferInputProc,
&(struct fillComplexBufferInputProc_t) { .bufferList =mp3Audio, .frames = frames, .packetDescriptions = packetDescription },
&frames,
pcmAudio,
NULL);
free(mp3Audio->mBuffers[0].mData);
free(mp3Audio);
free(packetDescription);
The first running of AudioConverterFillComplexBuffer is OK but when I run that function a second time, the infinite loop happens with cpuload 100%.
This code is OK on an IOS 7 device, but when I run it on an IOS 8 device, the infinite loop happens.
Could anyone tell me why this happens on IOS 8?
fillComplexBufferInputProc function:
static OSStatus fillComplexBufferInputProc(AudioConverterRef inAudioConverter,
UInt32 *ioNumberDataPackets,
AudioBufferList *ioData,
AudioStreamPacketDescription **outDataPacketDescription,
void *inUserData) {
struct fillComplexBufferInputProc_t *arg = inUserData;
for (int i = 0; i < ioData->mNumberBuffers; i++) {
ioData->mBuffers[i].mData = arg->bufferList->mBuffers[i].mData;
ioData->mBuffers[i].mDataByteSize = arg->bufferList->mBuffers[i].mDataByteSize;
}
if (NULL == *outDataPacketDescription) {
*outDataPacketDescription = arg->packetDescriptions;
}
*ioNumberDataPackets = arg->frames;
return noErr;
}
Because it seems no possible infinite loop in your code (except for-loop in fillComplexBufferInputProc function), I suggest you use Instruments (Time Profiler) to see what method is using the majority of CPU time. Check the stack trace for more information, so maybe we can help. Here is a tutorial for time profiler.
Can you help me,How to Increase interval in y-axis by one hour?, Thanks in advance.
Chart2.Series[0].YValueType = ChartValueType.Time;
Chart2.ChartAreas["ChartArea1"].AxisY.LabelStyle.Format = "HH:00 tt";
Chart2.ChartAreas["ChartArea1"].AxisY.Interval = 1;
for (int i = 0; i < 4; i++)
{
Chart2.Series[0].Points[i].AxisLabel = DateTime.Today.Date.AddDays(i).ToShortDateString();
}
View Image Click here (https://www.dropbox.com/s/gj2sq4ewoxdvqpj/PROBLEM.jpg)
I am using Open Flash Charts v2. I have been trying to make Conditional line graph. But I couldn't find any straight forward way, example or any class for producing Conditional charts.
Example of Conditional Graph
So I thought to use some techniques to emulate conditional graph ,I made separate Line object for values above limit range and then this line is used to overlap the plotted line.
This techniques works some what ok ,but there are problems with it,
How to color or place the conditional colored line exactly above the limit.
Remove tooltip and dot from limit line.
Tooltip of conditional line(red) and plotted line(green) are both shown ,I only need tooltip of green line.
Conditional Line Graph Problem illustrated
Source Code: // C#
var chart = new OpenFlashChart.OpenFlashChart();
var data1 = new List<double?> { 1, 3, 4, 5, 2, 1, 6, 7 };//>4=
var overlap = new List<double?> { null, null, 4, 5, null, null, null, null };
var overlap2 = new List<double?> { null, null, null, null, null, null, 6, 7 };
var limitData = new List<double?> { 4, 4, 4, 4, 4, 4, 4, 4 };
var line1 = new Line();
line1.Values = data1;
//line1.HaloSize = 0;
line1.Width = 2;
line1.DotSize = 5;
line1.DotStyleType.Tip = "#x_label#<br>#val#";
line1.Colour = "#37c855";
line1.Tooltip = "#val#";
var overLine = new Line();
overLine.Values = overlap;
//overLine.HaloSize = 0;
overLine.Width = 2;
overLine.DotSize = 5;
overLine.DotStyleType.Tip = "#x_label#<br>#val#";
overLine.Colour = "#d81417";
overLine.Tooltip = "#val#";
var overLine2 = new Line();
overLine2.Values = overlap2;
//overLine2.HaloSize = 0;
overLine2.Width = 2;
overLine2.DotSize = 5;
//overLine2.DotStyleType.Tip = "#x_label#<br>#val#";
//overLine2.DotStyleType.Type = DotType.DOT;
overLine2.Colour = "#d81417";
overLine2.Tooltip = "#val#";
var limit = new Line();
limit.Values = limitData;
limit.Width = 2;
limit.Colour = "#ff0000";
limit.HaloSize = -1;
limit.DotSize = -1;
// limit.DotStyleType.Tip = "";
limit.DotStyleType.Type = null;
//limit.Tooltip = "";
chart.AddElement(line1);
chart.AddElement(overLine);
chart.AddElement(overLine2);
chart.AddElement(limit);
chart.Y_Legend = new Legend("Experiment");
chart.Title = new Title("Conditional Line Graph");
chart.Y_Axis.SetRange(0, 10);
chart.X_Axis.Labels.Color = "#e43456";
chart.X_Axis.Steps = 4;
chart.Tooltip = new ToolTip("#val#");
chart.Tooltip.Shadow = true;
chart.Tooltip.Colour = "#e43456";
chart.Tooltip.MouseStyle = ToolTipStyle.CLOSEST;
Response.Clear();
Response.CacheControl = "no-cache";
Response.Write(chart.ToPrettyString());
Response.End();
Note:
I have already downloaded the OFC (Open Flash Charts) source ,If I modify the OFC Line.as source than how would I be able to generate json for the changed graph ? ,b/c I'm currently using .Net library for the json generation for OFC charts,please do let me know this also.
Update:
I have modified the source code on the advice of David Mears I'm using FlashDevelop for ActionScript.
P.S: I'm open for ideas if another library can do this job.
If you don't mind a little rebuilding, you can get the source of OFC here and modify the Line.solid_line() method in open-flash-chart/charts/Line.as to do this fairly easily.
In order to set the extra chart details through JSON using the .NET library, you'll also have to modify OpenFlashChart/LineBase.cs to add alternative colour and boundary properties. I'm not hugely familiar with .NET, but based on the existing properties you might add something like this:
private double boundary;
private string altcolour;
[JsonProperty("boundary")]
public virtual double Boundary
{
set { this.boundary = value; }
get { return this.boundary; }
}
[JsonProperty("alt-colour")]
public virtual string AltColour
{
set { this.altcolour = value; }
get { return this.altcolour; }
}
Then I believe the following should work in Line.as:
public function solid_line(): void {
var first:Boolean = true;
var i:Number;
var tmp:Sprite;
var x:Number;
var y:Number;
var last_e:Element;
var ratio:Number;
for ( i=0; i < this.numChildren; i++ ) {
// Step through every child object.
tmp = this.getChildAt(i) as Sprite;
// Only include data Elements, ignoring extra children such as line masks.
if( tmp is Element )
{
var e:Element = tmp as Element;
if( first )
{
if (this.props.get('alt-colour') != Number.NEGATIVE_INFINITY) {
if (e._y >= this.props.get_colour('boundary'))
{
// Line starts below boundary, set alt line colour.
this.graphics.lineStyle( this.props.get_colour('width'), this.props.get_colour('alt-colour') );
}
else
{
// Line starts above boundary, set normal line colour.
this.graphics.lineStyle( this.props.get_colour('width'), this.props.get_colour('colour') );
}
}
// Move to the first point.
this.graphics.moveTo(e.x, e.y);
x = e.x;
y = e.y;
first = false;
}
else
{
if (this.props.get('alt-colour') != Number.NEGATIVE_INFINITY) {
if (last_e._y < this.props.get_colour('boundary') && e._y >= this.props.get_colour('boundary'))
{
// Line passes below boundary. Draw first section and switch to alt colour.
ratio = (this.props.get_colour('boundary') - last_e._y) / (e._y - last_e._y);
this.graphics.lineTo(last_e.x + (e.x - last_e.x) * ratio, last_e.y + (e.y - last_e.y) * ratio);
this.graphics.lineStyle( this.props.get_colour('width'), this.props.get_colour('alt-colour') );
}
else if (last_e._y >= this.props.get_colour('boundary') && e._y < this.props.get_colour('boundary'))
{
// Line passes above boundary. Draw first section and switch to normal colour.
ratio = (this.props.get_colour('boundary') - last_e._y) / (e._y - last_e._y);
this.graphics.lineTo(last_e.x + (e.x - last_e.x) * ratio, last_e.y + (e.y - last_e.y) * ratio);
this.graphics.lineStyle( this.props.get_colour('width'), this.props.get_colour('colour') );
}
}
// Draw a line to the next point.
this.graphics.lineTo(e.x, e.y);
}
last_e = e;
}
}
if ( this.props.get('loop') ) {
// close the line loop (radar charts)
this.graphics.lineTo(x, y);
}
}
With the new open-flash-chart.swf, you should be able to just set your new properties on line1:
line1.Boundary = 4;
line1.AltColour = "#d81417";