iOS Line Graph Using X,Y Axis - ios

I searched many forums. But i need to Draw Line with X,Y Start point to Another X,Y End point. But i am not getting any solutions.
This is Asp.net code. I need something look like similer.
Grap.AddPoint(0, 0, "ff0000", "Red Line")
Graph.AddPoint(30, 30, "ff0000", "")
Graph.AddPoint(0, 0, "00ff00", "Green Line")
Graph.AddPoint(30, 20, "00ff00", "")
My Points.
Line 1:
From (0,0)
To (75,18)
Line 1:
From (0,0)
To (75,9)
Check Below Image for your reference.

Related

How to have multiple dots move at constant speed around a circle in manim?

I want to reproduce the animation here in manim.
I found how to have multiple dots move along a circle, but they only do one turn and don't have constant speed.
How to have them move at constant speed and do multiple turns ?
Here is my attempt up to now :
def construct(self):
circle = Circle()
points = Group(*[Dot((1, 0, 0)) for _ in range(2)])
self.add(circle)
self.add(points)
self.play(
MoveAlongPath(points[0], circle, run_time=1),
MoveAlongPath(points[1], circle, run_time=2)
)
Just found an answer, easier than I thought :
self.play(Rotating(points[0],
radians=2 * TAU,
about_point=ORIGIN),
Rotating(points[1],
radians=TAU,
about_point=ORIGIN),
)

Multiple Line chart with 2 dataSets

I am trying to draw Multiple line chart using iOS-Charts danielgindi/Charts library by as show in picture.
Expected Output:
Data1 = [Jun: 34, Jul: 42, Aug: 32, Sep: 30, Oct: 38]
Data2 = [Oct: 38, Nov: 40, Dec: 32, Jan: 40]
let dataSet1 = LineChartDataSet(values: Data1, label: nil)
dataSet1.lineDashLengths =[0]
dataSet1.drawCirclesEnabled = false
let dataSet2 = LineChartDataSet(values: Data2, label: nil)
dataSet2.lineDashLengths =[10]
dataSet2.drawCirclesEnabled = true
let data = LineChartData(dataSets:[dataSet1, dataSet2])
lineChartView?.data = data
I want to draw the first set with solid line and second set with Dotted line.
I am using iOS Charts library. (MultiLineChartView)
The problem which I m facing is the dotted line also start at the beginning of x-Axis. (As shown below)
Could anyone help me on this please?
You must be having minimum and maximum for the x-Axis so you just have to set the starting x-axis for your second set to be the ending x-axis of the first data set. A very good example is included in the examples as CombinedChartViewController. Please try to run the demo and play with the x-Axis of any type of chart,
ChartDataEntry(x: 0.5, y: 30)

Line chart with fix X axis label like healthkit graph in iOS

hello I want to create line chart similar to healthkit. For example i have on X axis (Jul 14, 15, 16, 17), Y axis (0, 50, 100) and data set in (x,y) format is ((jul 15, 30),(jul 17, 80))
I try following libraries
https://github.com/Boris-Em/BEMSimpleLineGraph/tree/master/Sample%20Project/SimpleLineChart
https://github.com/core-plot/core-plot
but all populate x axis based on data set. i.e all library only take parameter for data set based on that x axis and y axis labels are populated. Can you please suggest any other library through which I can achieve similar as explain above line chart. Thanks in advance.
Finally i solved my problem using
https://github.com/Boris-Em/BEMSimpleLineGraph/tree/master/Sample%20Project/SimpleLineChart
when there is no value i put (jul 15, BEMNullGraphValue).
Even this you could do it in your existing graph
Consider below example.
- {[0,5],[1,5],[3,5],[4,5]}
See there is no value for 2, so line chart will draw 0-5 to 1-5 then gap then 3-5 to 4-5.
I hope now you could figure out.
Still if you wish then get below graph library.
Do it with https://github.com/danielgindi/Charts
There are many properties like clip, scale, min, max etc for line chart.
Using though properties you could achieve.
https://github.com/danielgindi/Charts/issues/533
Edited answer
After doing some work around, i found the way.
Download sample code
let months = ["July 14", "15", "16", "17", "18", "19", "20"]
let unitsSold = [0.0, 0.0, 0.0, 100.0, 25.0, 50.0, 75.0]
for i in 0..<dataPoints.count {
if !values[i].isZero {
let dataEntry = ChartDataEntry(value: Double(values[i]), xIndex: i)
dataEntries.append(dataEntry)
}
}
Refer attached screen shot
In PNChart create one array of indexes which you want to skip the value. Put condition drawdot funtion on start of for loop of data array if array contain index value then continue.

How to call pdb.gimp_pencil in Gimp Python-fu plugin

I'm trying to automate the task of drawing lines with Gimp.
So I tried the scripting feature with no luck so far.
>>>from pprint import pprint
>>>img = gimp.Image(200, 200, RGB)
>>>pprint (pdb.gimp_pencil.params)
((16, 'drawable', 'The affected drawable'),
(0,
'num-strokes',
'Number of stroke control points (count each coordinate as 2 points) (num-strokes >= 2)'),
(8,
'strokes',
'Array of stroke coordinates: { s1.x, s1.y, s2.x, s2.y, ..., sn.x, sn.y }'))
>>>pdb.gimp_pencil(img, 4, [0,0,200,200] )
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: wrong parameter type
I couldn't find any example of passing a vector (Array of stroke coordinates) in Python for Gimp
What's wrong here?
Ok my mistake, I assumed the TypeError was on the last array argument. As it happens img is not the drawable, hence the TypeError.
You have to:
create an image
create a layer
add the layer to the image
set the layer active
obtain the active drawable of the image
Then only you can use this drawable in the gimp_pencil() method.
img = gimp.Image(200, 200, RGB)
layer = gimp.Layer(img, "Test", 200, 200, RGBA_IMAGE, 100, NORMAL_MODE)
img.add_layer(layer, -1)
pdb.gimp_image_set_active_layer(img, layer)
draw = pdb.gimp_image_get_active_drawable(img)
pdb.gimp_pencil(draw, 4, [0,0,100,100])
disp1 = gimp.Display(img)

How to straighten line endings in Cocos2d?

I'm new to Cocos2d and am trying out some of the basic drawing functions. When I draw a straight line with a high width (50 in this case), the ends of the line are not what I'd expect. What I'd like is for the line to be the same as it would be if I were using CoreGraphics, like this:
however what I see in Cocos2d is this:
The code I'm using to draw the line is in the layer's draw method:
-(void)draw
{
glColor4f(1, 0, 0, 1);
glLineWidth(50);
ccDrawLine(ccp(50, 50), ccp(250, 250));
}
Can anyone tell me how I can get cocos2d to draw a line with the same shape as the green image, rather than the red image?
Try drawing it antialiased.
glColor4f(1, 0, 0, 1);
glLineWidth(50);
glEnable(GL_LINE_SMOOTH);
ccDrawLine(ccp(50, 50), ccp(250, 250));

Resources